Repository navigation
docs: sync Release Management Apps API reference from updated spec #1372
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| GTM_ID: ${{ secrets.GTM_ID || '' }} | |
| GEN_SEARCH_WIDGET_ID: ${{ vars.GEN_SEARCH_WIDGET_ID || '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| !node_modules/.cache | |
| key: node-modules-${{ runner.os }}-node20-${{ hashFiles('package-lock.json') }} | |
| - name: Cache Docusaurus build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules/.cache | |
| .docusaurus | |
| key: docusaurus-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| docusaurus-${{ runner.os }}- | |
| - run: npm install | |
| - run: npm run build | |
| # A literal <Partial_Foo /> left in a generated .md means the llms plugin | |
| # stopped resolving '@site/src/partials/*.mdx' imports — invisible on the | |
| # docs site itself, so nothing else catches it. Blocking on pull requests | |
| # so a regression can't merge; advisory on main so a degraded AI mirror | |
| # never holds up a site deploy. | |
| - name: Assert partials expanded in generated markdown | |
| continue-on-error: ${{ github.event_name != 'pull_request' }} | |
| run: node scripts/check-generated-partials.js | |
| # Dependabot-triggered pull_request runs don't get repository secrets | |
| # (GitHub sandboxes them like third-party PRs), so CF_API_TOKEN_PAGES | |
| # resolves empty and wrangler fails. Skip the deploy for those runs; | |
| # the change still deploys normally once merged to main via push. | |
| - name: Deploy to Cloudflare Pages | |
| if: github.actor != 'dependabot[bot]' | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CF_API_TOKEN_PAGES }} | |
| accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
| command: pages deploy ./build --project-name=bitrise-docs --branch=${{ github.head_ref || github.ref_name }} | |
| # Redirects are served by a Cloudflare Bulk Redirects list, not by the | |
| # Pages deploy above. Editing redirects.json has no effect until this | |
| # syncs it, so run it on every push to main. Gated off PRs so preview | |
| # builds never mutate the production redirect list. | |
| - name: Upload redirects to Cloudflare | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: npm run cloudflare:upload_redirects | |
| env: | |
| CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
| CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | |
| - name: Comment preview URL | |
| if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| // Match Cloudflare Pages' branch-alias rules: lowercase, replace | |
| // non-alphanumerics with hyphens, truncate to 28 chars, then strip | |
| // leading/trailing hyphens (a label can't begin or end with one). | |
| const branch = context.payload.pull_request.head.ref | |
| .toLowerCase() | |
| .replace(/[^a-z0-9]+/g, '-') | |
| .substring(0, 28) | |
| .replace(/^-+|-+$/g, ''); | |
| const url = `https://${branch}.bitrise-docs.pages.dev`; | |
| const body = `Preview: ${url}`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| ...context.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body.startsWith('Preview:')); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| ...context.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| ...context.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |