Skip to content

Migrate GH Pages deploy to artifact-based deployment#783

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

Migrate GH Pages deploy to artifact-based deployment#783
mmcky merged 2 commits into
mainfrom
migrate-gh-pages-artifacts

Conversation

@mmcky

@mmcky mmcky commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates GitHub Pages deployment from the gh-pages branch (peaceiris/actions-gh-pages) to native artifact-based deployment, following the QuantEcon infrastructure guide in QuantEcon/meta#282. lecture-python-programming was migrated the same way in QuantEcon/lecture-python-programming#499. Once the gh-pages branch is deleted (final step, after verification), the repo drops from ~767 MB to ~15 MB.

This PR only touches the two workflow files. Merging it changes nothing on the live site — the site keeps serving from gh-pages until we flip the Pages source in repo Settings (a manual post-merge step). So there is no downtime window from merging.

What changed

publish.yml

  • Adds a top-level permissions block, a pages concurrency group, and the github-pages environment on the job.
  • Replaces the peaceiris/actions-gh-pages@v4 step with configure-pages@v6 + upload-pages-artifact@v5 + deploy-pages@v5, writing intro.quantecon.org into _build/html/CNAME first.
  • The Netlify deploy, release-asset upload, _build cache upload, and notebook sync are all left untouched.

linkcheck.yml

  • Replaces the gh-pages checkout (which won't exist after migration) with a download of the latest release .tar.gz, and swaps lychee for QuantEcon/action-link-checker@main — matching the standard now used by lecture-python-programming.

Note on the permissions block

The workflow previously ran with the default permissive token. Because specifying permissions: resets every unlisted scope to none, the block enumerates everything this workflow actually needs. Two entries are specific to this repo (the programming reference did not need them):

Permission Why it is required here
contents: write Release-asset upload (softprops/action-gh-release) and Netlify commit comment
actions: read dawidd6/action-download-artifact pulls the build-cache artifact from cache.yml
statuses: write Netlify step posts a commit status
pages: write actions/deploy-pages
id-token: write OIDC token required by actions/deploy-pages

Post-merge steps (manual — do NOT skip the order)

Per QuantEcon/meta#282 §7.2, after this merges:

  1. Settings → Pages → set Source to GitHub Actions.
  2. Settings → Environments → github-pages → add a Tag deployment rule publish* (without this the first tag deploy fails with "Tag is not allowed to deploy… due to environment protection rules").
  3. Push a test publish-* tag and watch the run.
  4. Verify: site loads, build_type: workflow, release assets attached, notebook sync ran, Netlify deployed.
  5. Run linkcheck via workflow_dispatch and confirm it downloads the release asset.
  6. Delete the gh-pages branch and notify the team to prune locally.

Rollback

If anything looks wrong before step 6: Settings → Pages → Source → "Deploy from a branch" → gh-pages, and the site immediately serves from the old branch again.

🤖 Generated with Claude Code

Replace peaceiris/actions-gh-pages with native GitHub Pages deployment
(configure-pages / upload-pages-artifact / deploy-pages) and update the
linkcheck workflow to download the release HTML archive instead of
checking out the gh-pages branch.

- publish.yml: add permissions (contents/actions/statuses/pages/id-token),
  concurrency group, and the github-pages environment; write CNAME into
  the build output; keep Netlify, release-asset upload, and notebook sync
  untouched
- linkcheck.yml: download the latest release .tar.gz and run the QuantEcon
  AI link-checker instead of lychee against a gh-pages checkout

Part of QuantEcon/meta#282

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 6, 2026 00:36
@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 51c25b5
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a4afb2bad3710000852fec7
😎 Deploy Preview https://deploy-preview-783--taupe-gaufre-c4e660.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 publishing from a gh-pages branch deployment to the native artifact-based Pages deployment flow, and updates link checking to operate on the latest release HTML archive (rather than checking out gh-pages) as part of the planned branch deletion/size reduction.

Changes:

  • Update publish.yml to deploy via actions/configure-pages + actions/upload-pages-artifact + actions/deploy-pages, including explicit workflow permissions and a Pages concurrency group.
  • Update linkcheck.yml to download and extract the latest release .tar.gz HTML archive and run QuantEcon/action-link-checker.

Reviewed changes

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

File Description
.github/workflows/publish.yml Switches Pages deployment from peaceiris/actions-gh-pages to artifact-based Pages deployment with explicit permissions/concurrency.
.github/workflows/linkcheck.yml Replaces gh-pages checkout + lychee with “download latest release HTML” + QuantEcon link checker.

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

Comment thread .github/workflows/linkcheck.yml
Comment thread .github/workflows/linkcheck.yml Outdated
Comment thread .github/workflows/linkcheck.yml Outdated
Comment thread .github/workflows/linkcheck.yml
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request July 6, 2026 00:43 Inactive
@github-actions github-actions Bot temporarily deployed to pull request July 6, 2026 00:45 Inactive
- add contents:read so the gh api releases call works under a restrictive
  permissions block
- set -euo pipefail; select a single .tar.gz asset and fail with a clear
  error when none is found
- curl -fsSL so an HTTP error page fails the step instead of being piped
  into tar

Keeps QuantEcon/action-link-checker@main (first-party org action; matches
the reference in lecture-python-programming).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mmcky

mmcky commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Addressed Copilot's 4 comments in 51c25b5:

  • Added contents: read for the gh api releases call (①)
  • set -euo pipefail + single-asset selection + fail-fast when no .tar.gz is found (②)
  • curl -fsSL so download errors fail the step instead of piping into tar (③)
  • Kept QuantEcon/action-link-checker@main — first-party org action, matches lecture-python-programming (④, replied with rationale)

The three hardening changes were filed for the identical workflow in lecture-python-programming as QuantEcon/lecture-python-programming#566 to keep both repos in sync.

@github-actions github-actions Bot temporarily deployed to pull request July 6, 2026 00:55 Inactive
@github-actions github-actions Bot temporarily deployed to pull request July 6, 2026 00:55 Inactive
@mmcky mmcky merged commit ffc92c2 into main Jul 6, 2026
7 checks passed
@mmcky mmcky deleted the migrate-gh-pages-artifacts branch July 6, 2026 04:18
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