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