From 9339f6151aab749798203bd420650746e4b7b859 Mon Sep 17 00:00:00 2001 From: Roland Kakonyi Date: Mon, 9 Oct 2023 15:19:32 +0200 Subject: [PATCH] feat(apidocs): add automation --- .github/workflows/generate-documentation.yml | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/generate-documentation.yml diff --git a/.github/workflows/generate-documentation.yml b/.github/workflows/generate-documentation.yml new file mode 100644 index 00000000..7359f9d0 --- /dev/null +++ b/.github/workflows/generate-documentation.yml @@ -0,0 +1,58 @@ +name: Generate documentation +on: + workflow_call: + secrets: + PLAYER_CI_GH_TOKEN: + description: GitHub token to access player-ci repo for CI scripts + required: true + GCS_ACCOUNT: + description: Google Cloud Storage account for uploading API docs + required: true + CF_TOKEN: + description: CloudFlare token for API docs cache purging + required: true + CF_ZONEID: + description: CloudFlare zone ID for API docs cache purging + required: true + + workflow_dispatch: + +jobs: + generate-documentation: + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GC_SACCOUNT: ${{ secrets.GCS_ACCOUNT }} + CF_TOKEN: ${{ secrets.CF_TOKEN }} + CF_ZONEID: ${{ secrets.CF_ZONEID }} + + name: Generate documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup node and npm registry + uses: actions/setup-node@v3 + with: + node-version: '16' + registry-url: 'https://registry.npmjs.org/' + cache: 'yarn' + + - name: Install node_modules + run: yarn install --frozen-lockfile + + - name: Detect version using jq + run: | + echo "PCI_BRANCH=$(jq -r '.version' package.json)" >> $GITHUB_ENV + + - name: Generate documentation + run: yarn docs + + - name: Install CI scripts + run: | + curl -sS -H "Authorization: token ${GH_TOKEN}" -L https://raw.githubusercontent.com/bitmovin-engineering/player-ci/master/install.sh | bash + + - name: Upload to CDN + run: node ./ci_scripts/src/uploadToGcs.js reactnative ./docs/generated + + - name: Purge CDN cache + run: node ./ci_scripts/src/purgeCloudflarePath.js 'reactnative'