Repository navigation
feat: deploy-release, a reusable workflow that deploys a release to GitHub Pages, or an earlier one to roll back - #357
Merged
Merged
Conversation
…itHub Pages, or an earlier one to roll back (#355) For a lecture repository whose site is built elsewhere and arrives as one of its releases (QuantEcon/project-monorepo#78): on a release published for a publish-* tag it deploys that release's site, and on a dispatch with a tag it deploys that tag's release, which is the rollback. - .github/workflows/deploy-release.yml: two jobs. upload restores the site with restore-gh-pages and uploads it with publish-gh-pages' mode: upload (contents: read); deploy deploys it with mode: deploy (pages and id-token write, the github-pages environment, the pages concurrency group without cancelling), so a failed deploy re-runs alone. The release filter lets a dispatch through; the tag is chosen in a step through env:. The actions are named at @v0, since a called workflow's ./ paths are the caller's. - templates/deploy-release.yml: the caller, on release: published and workflow_dispatch with a tag, with the job-level permissions its workflow may have and no third-party pins. - scripts/generate-docs.py: reusable workflows. Their inputs, secrets and outputs tables are written from on.workflow_call into docs/user/workflows/<workflow>.md, the index gains a Reusable workflows table, and a job calling one of them has its with: and secrets: checked against it (secrets: inherit refused). This repository's own reusable workflows are listed as internal. - docs: the chapter, docs/user/workflows/deploy-release.md; the index, getting-started, security, versioning, restore-gh-pages' chapter, TESTING.md (proven on the canary, not the harness) and ARCHITECTURE.md; a CHANGELOG entry. The notebooks push is deferred to #356. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
Required: - deploy-release.yml: the tag is checked against restore-gh-pages' rule before anything prints it, and the error does not echo it (#267). - templates/deploy-release.yml: pinning the workflow pins its jobs; the actions inside still run at @v0. - A failed deploy re-runs alone only while the upload is kept, one day (upload-pages-artifact's default); after that, dispatch the tag again. This corrects the first commit's message, which said it always finds the upload. - The chapter states what is true now: it does not push notebooks, and #356 tracks that. - Dev docs for adding a reusable workflow: CHAPTER-TEMPLATE.md (the Secrets block, and the call checks), CONTRIBUTING.md (the chapters, the Documentation table's row, staged releases and what the gate does not reach), TESTING.md and AGENTS.md. Also: - Disable an old publish.yml rather than remove it, since a tag at an older commit still carries the file; the caller must exist at the tagged commit (template prerequisite 6, troubleshooting). - Concurrency: a caller should not use the pages group at its top level or on the calling job. GitHub's documentation does not say how a called job's group meets its caller's, so the chapter says that rather than what happens. - generate-docs.py: the index's two blocks name their own sources, the drift message names either source, and check_examples' parameter is no longer shadowed. ARCHITECTURE.md's layout names the workflows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
- Concurrency: GitHub's docs (reusing workflow configurations) say a called workflow and its caller sharing a group with cancel-in-progress: true cancels the run already going, and say nothing of the same group without it. The chapter and the workflow's header now say that; the advice stands. This replaces the previous commit's sentence that GitHub does not document it. - CONTRIBUTING.md: the canary caller is dispatched from a publish-* tag on its branch, since the canary's github-pages environment admits only main and publish* tags; the examples are checked against each reusable workflow's on.workflow_call too. - The chapter links #356; the CHANGELOG says it does not push notebooks. - The tag input's description states the character rule the job enforces; the chapter's table is regenerated. - generate-docs.py: a call names the workflow's file exactly (a .yaml reference to a .yml file is refused), and a chapter for an internal workflow says it is internal. - CHAPTER-TEMPLATE.md, ARCHITECTURE.md: the workflow tables beside the actions'; TESTING.md names QuantEcon/test-lecture-dp. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
Merged
mmcky
added a commit
that referenced
this pull request
Nov 28, 2026
Cuts v0.22.0, a minor release: #357 and #345 add features, and nothing in it is marked⚠️ BREAKING. It carries #357's `deploy-release` reusable workflow, #345's `comment-key` and `toc-file`, and #346's images, whose CHANGELOG entries are already under `[Unreleased]`, and Dependabot's #348, #352 and #347, whose entries this PR writes. `v0` is on v0.21.1, and moves to v0.22.0 only after the release gate and the staging below have passed it. ## What's in it | Change | PR | |---|---| | `deploy-release`, the first reusable workflow for lecture repositories, and its caller, `templates/deploy-release.yml`: on a release published for a `publish-*` tag it deploys that release's site to GitHub Pages, and on a dispatch with a tag it deploys that tag's release, which is the rollback. Its `### Added` entry is already under `[Unreleased]` | #357 | | `comment-key` and `toc-file` in `preview-netlify`, `preview-cloudflare` and `preview-workers`, for several sites on one pull request. Both are empty by default, which leaves the comment, its marker and its links as they were. Its `### Added` entry is already under `[Unreleased]` | #345 | | Chrome for Testing 158 in both images, and kaleido 1.5.2. Its `### Changed` entry is already under `[Unreleased]`. `:latest` has carried it since 2026-11-19, so this release only records it | #346 | | wrangler 4.166.0 in `preview-cloudflare`, `preview-workers` and `deploy-cloudflare`, up from 4.162.0; netlify-cli 27.20.1 in `preview-netlify`, up from 27.19.0. Neither raises its minimum Node, which stays at 22.12 for wrangler and 22.13 for netlify-cli. One entry for both | #348, #352 | | Both images on the `ubuntu:24.04` image of 2026-11-10, pinned by digest. `:latest` has carried it since 2026-11-20, so this release only records it | #347 | Also merged since v0.21.1, with no entry of its own: #344 (PLAN), #350 (CI and docs: the canary watcher reads the canary's scheduled `ci.yml` and `publish.yml` runs) and #351 (PyYAML 6.0.4 in `scripts/requirements.txt`, CI only). ## Changes in this PR | File | Change | |---|---| | `CHANGELOG.md` | `## [0.22.0] - 2026-11-28` below an empty `## [Unreleased]`. Under `### Changed`, the entry for #348 and #352 first; then #346's, with one line added (both images rebuilt and smoke-tested, and `:latest` moved on 2026-11-19, before this release); then #347's. `### Added` keeps #357's and #345's entries as they were | | `docs/dev/PLAN.md` | The release line: the latest release is v0.22.0, and `@v0` is on v0.21.1 until the gate has passed it. The line counting the actions names the reusable workflow, `deploy-release`. The rows for `lecture-jax`, `lecture-python-intro`, `lecture-python-advanced.myst`, `lecture-python-programming`, `lecture-python-programming.fr` and `continuous_time_mcs` are on `@v0`, where PLAN said `@v0.12.0`, and the paragraph on their exact pins goes with them. QuantEcon/lectures' row names `setup-environment` too, which its `site-build.yml` runs on its full-image legs, `intro` and `advanced`, and counts the six sites it builds now. Two rollout lines that still named exact pins say `@v0`: `publish-gh-pages`' 8/8, and `lecture-jax`'s previews | The date is today's in UTC. ## What I checked - **The CHANGELOG:** the diff adds 12 lines and deletes none, and everything from `## [0.21.1]` down is byte-identical to `main`. Every PR merged since v0.21.1 has its entry, or is listed above. The lockfiles on `main` pin wrangler 4.166.0 (engines `>=22.12.0`) in all three Cloudflare actions and netlify-cli 27.20.1 (`>=22.13.0`). - **The consumers,** read today from each repository's default-branch workflows: `lecture-jax` and `lecture-python-programming.fr` call `preview-netlify@v0` (`ci.yml`) and `publish-gh-pages@v0` (`publish.yml`); `lecture-python-intro`, `lecture-python-advanced.myst`, `lecture-python-programming` and `continuous_time_mcs` call `publish-gh-pages@v0` (`publish.yml`). No other workflow in them names this repository. QuantEcon/lectures' `site-build.yml` runs `setup-environment@v0` on the legs whose `site.yml` gives a container runner and `environment: base`, which are `intro` and `advanced`, and `build-lectures@v0` on every leg. - **The build actions,** `setup-environment`, `setup-latex`, `build-lectures`, `build-jupyter-cache`, `restore-jupyter-cache`, `publish-gh-pages` and `restore-gh-pages`, are byte-identical to v0.21.1 at `19fdc20`, and none calls a script that has changed since. `deploy-cloudflare` changes only in its `package.json` and `package-lock.json` (#348, #352). - **`generate-docs.py --check --check-examples --actionlint`:** 24 files current; 75 `quantecon/actions` steps and 20 complete workflows checked, clean under actionlint 1.7.12. `actionlint` finds `.github/workflows/` clean, and `scripts/lint-shell.py`, with shellcheck 0.11.0, finds 74 `run:` scripts in 11 `action.yml` files, 216 in 9 workflows, and 16 `scripts/*.sh` clean. - **The harness skips this PR's files,** since the gate's `IGNORED` covers `CHANGELOG.md` and `docs/`. The evidence is `main`'s full harness at `19fdc20`, #351's merge commit, which comes after #352's lockfile changes: dispatched run https://github.com/QuantEcon/actions/actions/runs/46131794415, green on its first attempt, with 70 jobs passed and 5 skipped. ## Staging, after the tag As CONTRIBUTING's Staged Releases says, apart from the departures in steps 3 and 5: 1. **The release gate:** `gate.yml` on the canary's `main`, with `candidate=v0.22.0` and the self-test off, outside Sunday 00:00 to 03:00 UTC. It must be green, with each site serving the marker for the release commit, and its log must show both preview deploys running the new CLIs, wrangler 4.166.0 and netlify-cli 27.20.1. The run is linked here. 2. **A canary PR for #345's pull-request half,** which the gate doesn't reach: a branch `staged-v0.22.0` in the canary with every `quantecon/actions/...` step pinned `@v0.22.0`, inputs as `templates/` has them (no `comment-key`, no `toc-file`), and a one-line change to one lecture. Checked by hand: each provider's placeholder comment lists the changed lecture, and its deploy then replaces that same comment, with its marker as before; each `pr-<N>` preview serves the build's marker and the changed lecture, by content; a second push updates the same two comments. The PR is closed unmerged with a results note, and linked here. 3. **`deploy-release` on the canary,** which the gate doesn't reach and the harness checks only as a file: a caller on the canary's `main`, `templates/deploy-release.yml` with its `uses:` pinned `@v0.22.0`, merged on review; a release made by the canary's `publish.yml` on a new `publish-*` tag, which starts no `deploy-release` run; then a dispatch with `tag=publish-check-310`, the rollback path, and that new release published again, the release path. Each is checked by its upload job's `commit` and by the site serving, by content, a file whose bytes differ between the two releases. This departs from CONTRIBUTING, which stages on a canary branch: GitHub dispatches only a workflow that is on the default branch, and the canary's `github-pages` environment admits only `main` and `publish*` tags. The post-move PR updates CONTRIBUTING to match. The runs are linked here. 4. **No lecture matrix at the candidate:** the build actions are unchanged, and #346's and #347's images are already `:latest`. Monday's scheduled run 45098004558, on `main` at `06b493f` with `:latest` of 2026-11-20, ran this build path green on all 8 legs. 5. **Nothing staged by hand for `deploy-cloudflare` and `preview-workers`,** which the gate doesn't reach. Neither has an `@v0` consumer: the two `deploy-cloudflare` callers pin `v0.12.0`, and `preview-workers` has none yet (#299). The harness installs the pinned wrangler for both and runs it ("pinned CLIs install from their lockfiles and run", each action's "the pinned wrangler accepts the generated config", and `deploy-cloudflare` on Node 22.11 and 22.12), and covers #345's keyed and toc paths in its fixtures, all green in the run above. 6. **Once `v0` has moved,** which is asked for on its own: the canary's `cache.yml`, then `ci.yml`, on its `main`; its `deploy-release` caller moved to `@v0` and dispatched once more; then its `publish.yml`, so the site ends on a marked build; then a post-move PR here for PLAN's `v0` line, the canary drift check's workflow list, and TESTING's and CONTRIBUTING's lines on the reusable workflow. The move reaches the `@v0` callers of `preview-netlify` on default inputs, and QuantEcon/lectures' site build, whose `setup-environment` and `build-lectures` this release doesn't change. The runs are linked here. Copilot: not requested (Matt, 2026-11-22). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMYECPyC5K5RvEg6uiq
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #355 as its review settled it: a reusable workflow,
deploy-release, with a caller template, for a lecture repository whose site is built elsewhere and arrives as one of its releases (QuantEcon/project-monorepo#78). Matt approved the design on 2026-11-26, relayed by the organiser session ("Approve, with the refinements"; "monorepo writes, actions reviews").What it does
publish-*tag, it deploys that release's site to GitHub Pages.How
.github/workflows/deploy-release.yml, two jobs:upload:restore-gh-pagesat the tag, thenpublish-gh-pages'mode: upload, withcontents: readalone.deploy:needs: upload, thenmode: deploy, withpages: writeandid-token: write, in thegithub-pagesenvironment and thepagesconcurrency group without cancelling. Because the deploy is its own job, "Re-run failed jobs" re-runs it alone and finds the one upload, while that upload is kept (a day, upload-pages-artifact's default); after that, dispatch the tag again.taginput's description states the rule.if: github.event_name != 'release' || startsWith(github.event.release.tag_name, 'publish-'), so a dispatch passes. The tag is chosen in a step throughenv:: the input, otherwise the release's own.quantecon/actions/<action>@v0, since a called workflow's./paths are the caller's. The chapter and TESTING.md say what that means for a pinned caller.templates/deploy-release.yml: the caller, onrelease: publishedandworkflow_dispatchwith a tag. It sets job-levelpermissions:(a called workflow gets no more than its caller grants) and has no third-party pins. Its header lists the prerequisites, including that a release made byGITHUB_TOKENstarts no workflow, and that no other workflow may deploy on apublish*tag.scripts/generate-docs.pylearns reusable workflows. Their inputs, secrets and outputs tables are written fromon.workflow_callintodocs/user/workflows/<workflow>.md, and the manual's index gains a "Reusable workflows" table. A job that calls one has itswith:andsecrets:checked against the declaration, andsecrets: inheritis refused. This repository's owntest-containerandvalidate-containersare listed as internal.docs/user/workflows/deploy-release.md; the index;getting-started.md(the templates table);security.md(what each job holds);versioning.md(pinning the workflow doesn't pin its actions); a pointer fromrestore-gh-pages' chapter;TESTING.md;ARCHITECTURE.md; for whoever adds the next reusable workflow,CHAPTER-TEMPLATE.md(a workflow chapter, its Secrets block, the call checks),CONTRIBUTING.md(the gate paragraph, the Documentation table's row for a new reusable workflow, Staged Releases and what the gate does not reach) andAGENTS.md.templates/restore.ymlis unchanged and stays for repositories that build their own site.Not in this pull request
main, so that canary-drift doesn't read av0that lacks the template.Checked locally
python3 scripts/generate-docs.py --check --check-examples --actionlint(actionlint 1.7.12): 24 files current, 75 steps, 20 workflows clean, the new caller among them.actionlinton.github/workflows/: clean.python3 scripts/lint-shell.py(shellcheck 0.11.0): clean.The workflow's own behaviour can't run in this repository's harness: there is no Pages site here, and a stand-in
ghcan't be put inside a called workflow's jobs. So it is proven on the canary in the staged release, as planned: a caller pinned to the candidate; apublish-*tag through the canary's own publish; the dispatch path from that tag's ref; then a person re-publishing a release to firerelease: published. The App-made release is proven in the dp test double's rehearsal (QuantEcon/project-monorepo#27).🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG