From e2c8673d2073f67da7e79abb3dc0098769cd8265 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 28 May 2024 17:10:11 +0800 Subject: [PATCH] [ci] Add generate-api-docs.yml (#17052) --- .github/workflows/generate-api-docs.yml | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/generate-api-docs.yml diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml new file mode 100644 index 0000000000..4f1a701be1 --- /dev/null +++ b/.github/workflows/generate-api-docs.yml @@ -0,0 +1,66 @@ +name: Generate API docs JSON + +on: + workflow_dispatch: + inputs: + target_tag: + description: 'The ref (branch, tag or commit-id) to build API docs' + type: string + default: 'v3.8.4' + required: true + +jobs: + build-api-doc: + runs-on: ubuntu-latest + name: "Generate API docs JSON" + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.target_tag }} + + - name: Show ref + run: | + echo "ref: ${{ github.event.inputs.target_tag }}" + + - name: Download external libraries + run: | + EXT_VERSION=`grep checkout native/external-config.json | awk -F'"' '{print $4}'` + echo "EXT_VERSION: ${EXT_VERSION}" + git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external + + - name: Install Cocos Engine + run: | + npm i + + - name: Checkout the tool + uses: actions/checkout@v4 + with: + repository: cocos/creator-api-doc + path: creator-api-doc + ref: main + + - name: Generate + run: | + pwd + ls -l + ENGINE_ROOT=$(pwd) + echo "ENGINE_ROOT: ${ENGINE_ROOT}" + cd creator-api-doc + npm i + # apply the url patch for typedoc@0.22.13 + npm run apply-patch + npm run build + node ./lib/cli.js -p $ENGINE_ROOT -o $ENGINE_ROOT/Cocos-Creator-API.json + ls -l .. + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: Cocos-Creator-API + path: Cocos-Creator-API.json +