update #381
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
| # ββ Build and deploy the site ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # | |
| # ββ What replaced what ββ | |
| # The old workflow installed R, pandoc, blogdown and Hugo 0.150.0, ran | |
| # `blogdown::build_site()` and published `./docs` with peaceiris/actions-gh-pages | |
| # (which commits the built site to a gh-pages branch). None of that survives: | |
| # this site has no build step in that sense. It is static files plus one Python | |
| # script that writes ~250 more. | |
| # | |
| # ββ Why `actions/deploy-pages` and not a branch ββ | |
| # The alternative is setting Pages to serve `main` at `/`, which would mean | |
| # committing every generated page β ~250 files churning on every content edit, | |
| # burying the one-line change that actually happened. Uploading an artifact | |
| # keeps `main` as the thing you edit and nothing else: the generated pages, the | |
| # redirect stubs and sitemap.xml exist only in the deployment. | |
| # | |
| # One-time setting to match: **Settings β Pages β Source: GitHub Actions.** | |
| # Leave it on "Deploy from a branch" and this workflow will run, succeed, and | |
| # deploy nothing anyone can see. | |
| # | |
| # ββ Why only generate_pages.py runs here ββ | |
| # The three `update_*.py` are content pipelines, not build steps, and | |
| # `update_publications.py` with MAX_PUBLICATIONS = None takes minutes and hits | |
| # ORCID and CrossRef once per DOI β too slow and too rude for every push. They | |
| # stay local; their manifests are committed. If a manifest is stale, the site is | |
| # stale, and that is a content commit rather than a deploy problem. | |
| name: π Build and deploy | |
| on: | |
| push: | |
| branches: [main] | |
| # A manual run, for re-deploying without a content change β after flipping | |
| # the Pages source, for instance. | |
| workflow_dispatch: | |
| # Least privilege: read the repo, write a Pages deployment, and prove identity | |
| # to the deploy action. Nothing here needs to push a commit, which is the whole | |
| # difference from the branch-publishing approach. | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # One deployment at a time, and let a newer push win β but never cancel a | |
| # deployment already in flight, or Pages can be left half-updated. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| # No pip install: generate_pages.py imports only the standard | |
| # library, which is a property worth keeping. Pillow is used by the | |
| # asset scripts, and those do not run here. | |
| - name: Generate pages, stubs, sitemap and llms.txt | |
| run: python generate_pages.py | |
| # The two halves of "every URL this site writes is a URL it serves". | |
| # They take seconds and they are the check that would have caught | |
| # the self-redirecting hubs and the three sets of 404 routes found | |
| # in the pre-cutover audit β so they gate the deploy rather than | |
| # sitting in a folder nobody runs. | |
| - name: Check every writable route is a real page | |
| run: python tools/check-paths.py | |
| - name: Fail if the site is not at the deployed root | |
| # generate_pages.py writes root-absolute URLs into 148 pages and | |
| # every canonical is https://realitybending.github.io/β¦, so a | |
| # deployment from anywhere else is silently wrong rather than | |
| # broken. This is the cheapest possible guard on that assumption. | |
| run: | | |
| test -f index.html || { echo "index.html is not at the repo root β the site must be checked out at /"; exit 1; } | |
| test -f .nojekyll || { echo ".nojekyll is missing β Jekyll will eat the _-prefixed paths"; exit 1; } | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |