Skip to content

INFR: Migrate GitHub Pages deploy to artifact-based workflow - #213

Merged
mmcky merged 2 commits into
mainfrom
migrate-gh-pages-artifacts
Jul 7, 2026
Merged

mmcky merged 2 commits into
mainfrom
migrate-gh-pages-artifacts

Conversation

@mmcky

@mmcky mmcky commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What

Migrates GitHub Pages deployment from the legacy gh-pages branch method (peaceiris/actions-gh-pages) to the native, artifact-based deployment used across the family. This mirrors the reference implementation in lecture-dp, which already runs on this pattern. See QuantEcon/meta#282 for the overall strategy and rationale.

Why

The gh-pages branch accumulates a full HTML snapshot on every publish, bloating the repo and slowing clones over time. Artifact-based deployment stores nothing in git — the deployed site lives in the Pages infrastructure — so the repo stays small and the gh-pages branch can be deleted entirely.

Changes

File Change
.github/workflows/publish.yml Add pages/id-token permissions and a pages concurrency group; run the publish job in the github-pages environment; replace the peaceiris/actions-gh-pages@v4 step with quantecon/actions/[email protected] (handles the CNAME and creates release assets). The bespoke build — LaTeX PDF, download-notebook build, and the sync to continuous_time_mcs.notebooks — is unchanged.
.github/workflows/linkcheck.yml Stop checking out the gh-pages branch. Mirror the live site with wget (with a guard that surfaces a failure instead of reporting green on an empty mirror), so link checking no longer depends on the branch.

Required maintainer steps (settings — not in this PR)

The workflow change alone does not deploy. A repo admin must do the following, in order. Steps 2–3 must happen before the first tagged deploy or it will fail with "Tag is not allowed to deploy to github-pages due to environment protection rules."

  1. Merge this PR.
  2. Settings → Pages → Source → change to "GitHub Actions".
  3. Settings → Environments → github-pages → add a deployment rule of type Tag (not Branch) with the pattern publish*.
  4. Push a publish-* tag to trigger a deploy, then verify: the site loads at https://continuous-time-mcs.quantecon.org/, and gh api repos/QuantEcon/continuous_time_mcs/pages --jq '.build_type' returns workflow.
  5. Run the Link Checker workflow manually (workflow_dispatch) and confirm it mirrors the live site correctly.
  6. Once the deploy is verified, delete the now-unused branch to reclaim space:
git push origin --delete gh-pages

Rollback

If anything goes wrong before gh-pages is deleted: set Settings → Pages → Source back to "Deploy from a branch" → gh-pages, and the previous site serves again immediately.

🤖 Generated with Claude Code

Replace the peaceiris/actions-gh-pages deploy with native, artifact-based
GitHub Pages deployment via quantecon/actions/publish-gh-pages, matching the
family reference (lecture-dp). This removes the gh-pages branch dependency so
the branch can be deleted, keeping the repo small.

- publish.yml: add pages/id-token permissions and a "pages" concurrency
  group, run the publish job in the github-pages environment, and swap the
  deploy step for [email protected] (handles CNAME + release assets).
  The bespoke build (LaTeX PDF, download notebooks, notebook sync) is
  unchanged.
- linkcheck.yml: stop checking out gh-pages; mirror the live site with wget
  (with a mirror-failed guard) so link checking no longer needs the branch.

Requires a maintainer to switch Pages source to "GitHub Actions", add a
publish* deployment tag rule to the github-pages environment, and delete
gh-pages after a verified deploy.

See QuantEcon/meta#282

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 7, 2026 02:15
@netlify

netlify Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sparkly-moxie-de1f0e ready!

Name Link
🔨 Latest commit 44d77b5
🔍 Latest deploy log https://app.netlify.com/projects/sparkly-moxie-de1f0e/deploys/6a4c62b9c008a90008371cf1
😎 Deploy Preview https://deploy-preview-213--sparkly-moxie-de1f0e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for adorable-cucurucho-69162b ready!

Name Link
🔨 Latest commit 44d77b5
🔍 Latest deploy log https://app.netlify.com/projects/adorable-cucurucho-69162b/deploys/6a4c62b9df1dc90008e37da2
😎 Deploy Preview https://deploy-preview-213--adorable-cucurucho-69162b.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

Pull request overview

Migrates GitHub Pages deployment from a gh-pages branch-based approach to GitHub’s native artifact/OIDC Pages deployment, and updates link checking to validate against the live published site instead of the removed branch.

Changes:

  • Switch Pages publish workflow to OIDC/artifact-based deployment with appropriate permissions, concurrency, and github-pages environment.
  • Replace peaceiris/actions-gh-pages with quantecon/actions/publish-gh-pages for deployment (including CNAME + release assets).
  • Update link checking to mirror the live site via wget and gate lychee execution on a non-empty mirror.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/publish.yml Adds Pages/OIDC permissions + environment/concurrency and replaces branch-based deploy step with artifact-based Pages publish action.
.github/workflows/linkcheck.yml Stops checking out gh-pages and instead mirrors the live site before running lychee, with a guard for empty mirrors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/publish.yml Resolved
Comment thread .github/workflows/linkcheck.yml Resolved
@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 7, 2026 02:20 Inactive
- publish.yml: "Build & Publish to GH-PAGES" -> "Build & Publish to GH Pages"
  (drops the gh-pages branch connotation now that deploys are artifact-based)
- linkcheck.yml: "Link Checker [Anaconda, Linux]" -> "Link Checker"
  (the workflow uses no Anaconda)

Both names now match the family reference (lecture-dp).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions
github-actions Bot temporarily deployed to pull request July 7, 2026 02:27 Inactive
@mmcky
mmcky merged commit e7bf10c into main Jul 7, 2026
7 checks passed
@mmcky
mmcky deleted the migrate-gh-pages-artifacts branch July 7, 2026 05:28
mmcky added a commit that referenced this pull request Jul 7, 2026
* Fix linkcheck false positives introduced by the gh-pages migration

The artifact migration (#213) switched linkcheck from checking out the
gh-pages branch to a wget mirror of the live site. That mirror fetches
only HTML (--accept html), so lychee reported every local asset
(_static/*, _images/*) as "file not found"; the deploy also dropped 200
from --accept, so every working link (200) was flagged. Net result was
issue #214: 522 "errors" that were essentially all false positives
(0 real broken links, 0 timeouts).

Switch to checking the published HTML release asset instead — a permanent
tarball of the full site (HTML + assets), per QuantEcon/meta#282 lesson 2
and matching lecture-python-programming's linkcheck. Restore
--accept 200,403,503 and add --root-dir so root-relative links
(/_notebooks/*.ipynb, /_pdf/book.pdf) resolve against the site root. The
release-asset input also removes the dependency on the live site being
reachable at check time.

See QuantEcon/meta#282

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Check only top-level pages, skipping _static/ theme partials

The recursive glob also scanned _site/_static/webpack-macros.html, a Sphinx
theme partial containing raw Jinja (`{{ pathto(...) }}`) that lychee misread
as ~15 broken local links. Restrict to top-level '_site/*.html' — matching the
old checkout's '*.html' scope — so only real lecture pages are checked.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Make release-asset fetch non-fatal (Copilot review)

Under `set -eo pipefail`, a transient `gh api` failure aborted the fetch step
before the empty-input guard ran, so no 'release asset missing' report was
created. Add `|| true` (and silence stderr) so the guard still fires.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

This branch was previously deployed

1 inactive deployment
pull request — 44d77b5f Deployed Jul 7, 2026 by github-actions[bot]
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