Skip to content

publish: release a site built from the pool in its series' repository (dispatch only; test double until cutover) - #103

Draft
mmcky wants to merge 8 commits into
mainfrom
publish/release-in-series
Draft

mmcky wants to merge 8 commits into
mainfrom
publish/release-in-series

Conversation

@mmcky

@mmcky mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

A draft until QuantEcon/actions#354 is released at v0. It uses publish-gh-pages' release-repository and release-tag, which don't exist yet. Its first run is the publishing rehearsal on the dp test double (QuantEcon/project-monorepo#27), on Matt's go.

This is piece C of QuantEcon/project-monorepo#78, on Matt's "Approve, with the refinements" (2026-11-26, relayed by the organiser session).

What it adds

  • .github/workflows/publish.yml, by hand only (workflow_dispatch, with the site to publish). Four jobs:
    • target: looks the site up in TARGETS and refuses a site with no entry before anything is built. Until a site's cutover its target is a test double, never the live series: dp's is QuantEcon/test-lecture-dp.
    • build: builds the site with site-build.yml, exactly as every other build does.
    • release, in a job that runs no repository or notebook code:
      • mints the quantecon-lectures App's token for the one target repository, with contents: write alone, as Matt ruled;
      • chooses the tag: publish-<YYYY-MM-DD> (the day in Sydney, as the series name their publish tags), and on a second publish the same day b, then c and so on (Matt's practice: "publish-2026-11-27 and then publish-2026-11-27b");
      • releases the site there with publish-gh-pages' mode: release. The tag points at the target's default branch, and the manifest records this repository's commit.
    • The release is made with the App's token, not GITHUB_TOKEN, which would start no workflow in the target. So the target's deploy-release.yml (A reusable workflow that deploys a release to GitHub Pages, and redeploys an earlier one to roll back actions#355, in feat: deploy-release, a reusable workflow that deploys a release to GitHub Pages, or an earlier one to roll back actions#357) serves it.
  • site-build.yml gains a workflow_call trigger with a sites input, which the matrix job reads in place of SITES. A call has a concurrency group of its own, so a publish neither waits on nor displaces a push's build of main. Push, pull request, schedule and dispatch runs are unchanged.
  • Notes: README.md and site-build.yml say what publishes now.

What it publishes

The site's HTML, as site-build.yml builds it: html-<site>. dp's own site has also published notebooks since QuantEcon/lecture-dp#87, so until the site build makes them (QuantEcon/project-monorepo#77), a release from here would have no _notebooks/. That doesn't matter for the rehearsal, but it does before dp's cutover.

Checked

actionlint is clean on both workflows. The workflow can't run before QuantEcon/actions#354 is released: its first run is the rehearsal, which also tests the App-made release firing release: published in the target, and the target's own publish.yml not firing on the tag.

Copilot: not requested (Matt, 2026-11-22).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG

… (dispatch only; test double until cutover)

Piece C of QuantEcon/project-monorepo#78, on Matt's "Approve, with the
refinements" (2026-11-26).

- .github/workflows/publish.yml, by hand only: build one site with
  site-build.yml, then mint the quantecon-lectures App's token for the
  one target repository with contents: write alone, choose the tag
  (publish-YYYY-MM-DD, the day in Sydney, then b, c and so on the same
  day), and release the site there with publish-gh-pages' mode: release
  and its release-repository and release-tag (QuantEcon/actions#354).
  TARGETS maps a site to its repository; dp's is QuantEcon/test-lecture-dp
  until its cutover, and a site with no entry is refused first.
- site-build.yml: a workflow_call trigger with a sites input, read by
  the matrix job in place of SITES, and a concurrency group of its own
  for a call, so a publish neither waits on nor displaces a push's build.
- README.md, site-build.yml's notes: publish.yml and what it does.

It runs only once QuantEcon/actions#354 is released at v0, and its first
run is the rehearsal (QuantEcon/project-monorepo#27), on Matt's go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
mmcky added a commit that referenced this pull request Nov 26, 2026
…rve them at _notebooks/ (#104)

For QuantEcon/project-monorepo#77 ("with HTML, PDF and notebooks"): the notebooks. A site whose `site.yml` publishes notebooks now gets them, as its series' own publish does: the `jupyter` builder, strict, with the notebooks served at `_build/html/_notebooks/`, where quantecon-book-theme links each page's "Download Notebook" button. All four sites built today publish notebooks: dp since QuantEcon/lecture-dp#87, and intro, advanced and programming throughout. A release from the pool (#103) needs them, as does dp's shadow comparison.

## The order, and why it differs from the series'

The series build the notebooks first, then the HTML with `html-copy-notebooks`. Here that order would break the cache. On a cold build the notebook build would execute every page, the HTML build would then take every page from the cache, and the execution report, which reads the HTML build, would count 0 executed, so main would never save its cache.

The theme shows the button when `_build/html/_notebooks/` is a folder as it renders a page (`os.path.isdir(app.outdir / "_notebooks")`, quantecon-book-theme 0.22.2). So:
1. make that folder;
2. build the HTML, as now: it executes the pages, and the report counts them;
3. write the execution report;
4. build the notebooks, strict, from the cache the HTML build filled (after the report, because this build rewrites the environment the report reads);
5. copy each notebook under `_build/jupyter` into `_build/html/_notebooks/` at the same path, as build-lectures' `html-copy-notebooks` does.

The site gets the same files and the same buttons as the series' order would give it.

Each new step runs only for a site that publishes notebooks. The notebook build has its own failure artefact, `execution-reports-<key>-notebooks`.

## What to expect from this pull request's builds

The keys don't change, so every site restores its cache, and the notebook build takes every page from it. Each site's HTML gains the button and `_notebooks/`. I'll compare the result with the series' own sites (dp's 52 notebooks, as in QuantEcon/lecture-dp#87's comparison) and post it here.

actionlint is clean. Copilot: not requested (Matt, 2026-11-22).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
mmcky and others added 2 commits November 26, 2026 22:59
…-in-series

One conflict, in site-build.yml's "WHAT IT DOES NOT DO" note: both sides
edited it; it now says publish.yml publishes and the build makes HTML
and the notebooks, not yet the PDF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved publishing issues allow failed API lookups to bypass tag-collision checks and point the dp rehearsal’s notebook downloads to the live site rather than its own release.

2 open issues
What changed in this PR

Adds manual publishing of pool-built lecture sites through releases in their target repositories. Publishing initially targets the dp test double for rehearsal and depends on the forthcoming publish-gh-pages action update.

Changes:

  • Adds target validation, App-authenticated releases, and Sydney-date tags with same-day suffixes.
  • Makes site-build.yml reusable with selectable sites and separate publish concurrency, preserving existing triggers.
  • Documents the manual publishing path and test-double rollout.
File Description
README.md Documents the publishing workflow alongside existing build workflows.
.github/​workflows/​site-build.yml Adds reusable-workflow inputs, site selection, and publish-specific concurrency.
.github/​workflows/​publish.yml Adds the manual target lookup, site build, and cross-repository release workflow.

Review effort: Max (adaptive)


env:
# site -> owner/repository its releases go to, until its cutover.
TARGETS: dp=QuantEcon/test-lecture-dp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left as it is, on purpose, and now said in the header (519beb8). The rehearsal sends the test double the site exactly as dp's cutover will publish it, built from sites/dp/_config.yml, the copy of lecture-dp's that drift-check keeps. So its pages keep the live site's addresses throughout: canonical links (html.baseurl), Download Notebook links (download_nb_path) and the links to itself. Rewriting only download_nb_path for the test double would leave the rest pointing at the live site anyway. Rewriting all of them would rehearse an artefact the cutover never publishes. What the rehearsal records is the release firing the deploy, the site being served, a dispatch at an older tag restoring it, and the time from tag to live (QuantEcon/project-monorepo#27). None of those reads a notebook link. The release does carry this build's own _notebooks/, so they can be compared there if wanted. If the maintainer wants the test double self-contained, the place is a site.yml override of the three addresses for a test-double target, and I will do it then.

env:
GH_TOKEN: ${{ steps.app.outputs.token }}
REPOSITORY: ${{ needs.target.outputs.repository }}
run: |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 519beb8, and right: a run step without shell gets bash -e {0}, with no pipefail. publish.yml now sets defaults.run.shell: bash for the whole workflow, which Actions runs as bash --noprofile --norc -eo pipefail {0}. A failed gh api in the tag lookup now fails the step before a tag is chosen. No other step has a pipeline that relies on the old behaviour. site-build.yml, which publish.yml calls, already sets the same default. actionlint is clean.

mmcky and others added 5 commits November 27, 2026 11:52
…esses

- defaults.run.shell is bash, which GitHub Actions runs as bash -eo
  pipefail: a step without `shell` got bash -e alone, so a failed `gh api`
  in the tag lookup left `taken` empty and chose the plain tag even when it
  was taken (Copilot's point).
- The header says a test double is sent the site as its cutover will publish
  it, so its pages keep the live site's addresses (html.baseurl,
  download_nb_path, its links to itself); the rehearsal checks the release,
  the deploy and the rollback, not those links.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
Adds tojupyter_urlpath and tojupyter_image_urlpath, the addresses in the
notebooks the pages offer, and says the self-link applies to a site that
maps itself (dp, a consumer, does not). From the organiser's review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
site-build.yml's three conflicts:

- The header's "what it does not do": main's second-phase wording, with
  this branch's "publish (publish.yml does, with it)".
- The concurrency comment: both; a push compared with the last build that
  succeeded, and a call's group of its own.
- The site choice: a call from publish.yml (its event is the caller's)
  now builds the sites it names in "Choose the sites the change reaches",
  whatever changed, instead of in the matrix step, which takes main's
  keys and empty-set skip.

publish.yml's build job grants actions: read as well: a called
workflow's jobs get no more than the calling job grants, and site-build's
first job asks for it. A test checks both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants