fix(ci): fail deploy guard on operational errors #1716
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: | |
| - '**' # matches all branches | |
| - '!gh-pages' # excludes gh-pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| # Serialize deploys to gh-pages. Concurrent master pushes race the | |
| # JamesIves force-push (cannot lock ref) — run 35056225053 failed at | |
| # 2026-09-16T04:38Z while the next SHA's deploy succeeded 9s later. | |
| # GitHub does not guarantee FIFO ordering within a concurrency group, so | |
| # the deploy step also verifies that this run still targets the ref head. | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
| jobs: | |
| build-and-deploy: | |
| name: Build and deploy (ruby-${{ matrix.ruby_version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| ruby_version: ['3.3'] | |
| steps: | |
| - name: Checkout 🛎️ | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby_version }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| sudo npm install --global pug pug-cli | |
| make install-deps | |
| - name: Build | |
| run: | | |
| make build | |
| - name: Check deployment is current | |
| id: deploy-check | |
| if: github.ref == 'refs/heads/master' | |
| run: | | |
| python3 scripts/check_deploy_is_current.py \ | |
| --repository "${{ github.repository }}" \ | |
| --ref "heads/master" \ | |
| --run-sha "${{ github.sha }}" \ | |
| --token "${{ github.token }}" \ | |
| --github-output "${{ github.output }}" | |
| - name: Deploy 🚀 | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| if: >- | |
| github.ref == 'refs/heads/master' && | |
| steps.deploy-check.outputs.is-current == 'true' | |
| with: | |
| branch: gh-pages | |
| folder: _site | |
| git-config-name: GitHub Actions | |
| git-config-email: noreply@github.com |