Skip the documentation gate on push to main (#32) #30
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: Docs Deploy | |
| # Build the documentation and deploy it to GitHub Pages. Triggers directly on | |
| # push to main -- there is no longer a caller workflow multiplexing verify vs. | |
| # deploy, so each half of that split (docs-ci.yml, this file) carries its own | |
| # triggers and only the permissions it actually needs. Deploy is the only job | |
| # that needs pages/id-token, which is why it stayed a separate file rather than | |
| # folding into docs-ci.yml: a single workflow can never grant a job more | |
| # permission than the workflow itself declares, so combining them would hand | |
| # the gate and verify jobs credentials they have no use for. | |
| "on": | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: github-pages | |
| cancel-in-progress: false | |
| defaults: | |
| run: | |
| shell: pwsh | |
| jobs: | |
| deploy: | |
| name: Build and Deploy Documentation | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| # Run the build inside the published base image (template under /template | |
| # with node_modules and PowerShell installed). | |
| container: | |
| image: ghcr.io/the-running-dev/docs-template:latest | |
| credentials: | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.REGISTRY_TOKEN || github.token }} | |
| steps: | |
| - name: Check out Repository | |
| uses: actions/checkout@v7 | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Build Documentation | |
| run: /template/scripts/docs-build.ps1 -SourceDocs ./docs -OutputPath artifacts/docs | |
| # The landing page is a second, independent project (site/) sharing | |
| # this one GitHub Pages deployment: it serves "/", the docs serve | |
| # "/docs". The base image already has Node -- no setup-node needed. | |
| # | |
| # `check`, not a bare build -- see docs-ci.yml's verify job, which | |
| # runs the same command. This job is the one that actually runs on | |
| # a push to main (verify skips push events), so it is also the | |
| # last thing standing between a broken landing page and a real | |
| # deploy if a check was ever bypassed getting there. | |
| - name: Build and verify landing page | |
| run: | | |
| npm --prefix site ci | |
| npm --prefix site run check | |
| # Overlays the landing page onto the docs build -- see | |
| # build/Merge-LandingPage.ps1, and the same step in docs-ci.yml's | |
| # verify job, which proves this on every PR before it ever runs | |
| # here on push to main. | |
| - name: Merge landing page into documentation build | |
| run: ./build/Merge-LandingPage.ps1 -LandingDist site/dist -DocsOutput artifacts/docs | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: artifacts/docs | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |