Skip to content

ci: migrate Pages deploy to actions/deploy-pages - #308

Merged
ShixiangWang merged 1 commit into
mainfrom
ci/deploy-pages-migration
Oct 9, 2026
Merged

ShixiangWang merged 1 commit into
mainfrom
ci/deploy-pages-migration

Conversation

@ShixiangWang

@ShixiangWang ShixiangWang commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Migrate GitHub Pages deployment from the legacy quarto publish gh-pages
target to the official actions/deploy-pages flow in both publish
workflows (issue #306, item A1).

Problem

The current deploy step (quarto-dev/quarto-actions/publish@v2 with
target gh-pages) force-pushes the entire rendered site (~493 MB) to the
gh-pages branch on every deploy. With 434 commits on gh-pages, this is
the single largest driver of repository growth tracked in issue #306.
Every deploy permanently appends a full site snapshot to git history.

Change

Replace the quarto publish action with the official three-step Pages
flow in both workflows (quarto-publish.yml, quarto-publish-update-cache.yml):

  1. actions/upload-pages-artifact@v3 packages _site as the github-pages
    artifact (keeps its original step conditions)
  2. actions/configure-pages@v6 configures the Pages site
  3. actions/deploy-pages@v5 deploys the artifact directly to the
    github-pages environment

Configure/Deploy steps are skipped for pull_request events (same
conditions as the previous deploy step), so PR preview builds are
unaffected. Both workflows already declare the required pages write and
id-token write permissions, and the github-pages environment exists in
the repo.

Expected benefit

  • Repo growth stopped: deploys no longer append ~493 MB per push to git
    history.
  • Follow-up enabled: once this is merged and verified live, the
    gh-pages branch (434 commits, ~493 MB tip) can be deleted entirely.

Verification plan

  • CI on this PR renders the site and uploads the artifact (deploy steps
    skip on PR).
  • After merge: verify the first deploy-pages run deploys the site
    successfully and the live site works, then delete the gh-pages branch
    in a follow-up step.

Refs: #306

🤖 Generated with Claude Code

Replace quarto publish --target gh-pages with the official
actions/deploy-pages flow (upload-pages-artifact, configure-pages,
deploy-pages) in both publish workflows.

Motivation: the legacy gh-pages target force-pushes the entire rendered
site (~493 MB) to the gh-pages branch on every deploy, growing the
repository history indefinitely. This is the main driver of repository
growth tracked in issue #306 (item A1).

With this change the site is packaged as the github-pages artifact and
deployed directly to the github-pages environment. The Upload Quarto
artifacts step keeps its original conditions; Configure/Deploy are
skipped for pull_request events (same conditions as the previous deploy
step).

Note: after this migration is verified live, the gh-pages branch can be
deleted (Pages source switches from branch-based to workflow-based
automatically on the first deploy-pages run).

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ QMD Format Check

No new QMD tutorial files to check.

Automated check by the PR Review workflow.
See contribution guidance for the expected tutorial format.

@ShixiangWang

Copy link
Copy Markdown
Member Author

CI verification complete on this PR — all green ✅

  • Render the new Quarto files (pull_request_target): pass (5m8s) — Upload Quarto artifacts correctly skipped on PR, as designed
  • Github Page (pull_request, full render): pass (1h4m18s) — Upload Quarto artifacts completed/success; Configure/Deploy correctly skipped on PR
  • format-check: pass

Deploy path (Configure Pages → Deploy to Pages) will execute on the first merge push to main. After merge I will verify the first deploy-pages run and the live site before deleting the gh-pages branch.

@ShixiangWang
ShixiangWang merged commit 209c75f into main Oct 9, 2026
3 checks passed
@ShixiangWang
ShixiangWang deleted the ci/deploy-pages-migration branch October 9, 2026 05:39
ShixiangWang added a commit that referenced this pull request Oct 9, 2026
The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>
ShixiangWang added a commit that referenced this pull request Oct 9, 2026
* ci: upgrade workflow actions to Node24-compatible majors

Resolve the "Node.js 20 is deprecated" runner annotations by bumping
all GitHub Actions to their latest Node24-based majors:

- actions/checkout v4 -> v7
- actions/setup-python v5 -> v7
- actions/github-script v7 -> v9
- actions/upload-pages-artifact v3 -> v5 (wraps upload-artifact v7)
- actions/upload-artifact v4 -> v7
- actions/cache (incl. restore/save) v4 -> v6
- julia-actions/setup-julia v2 -> v3
- tj-actions/changed-files v46.0.5 -> v47.0.6

actions/configure-pages@v6 and actions/deploy-pages@v5 are already the
latest majors. quarto-dev/quarto-actions@v2 and r-lib/actions@v2 track
their latest majors (v2.2.0 / v2) and are kept.

Version-only change: no step logic, inputs, or permissions modified.
Verified all eight workflow YAML files still parse.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: require github-pages environment for deploy-pages job

The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: move Pages deploy to dedicated job gated on non-PR events

The github-pages environment protection rules only allow deployments
from main (and legacy gh-pages), so a job targeting the environment
fails on pull_request events (ref refs/pull/<n>/merge) before any
step runs. Split the deploy steps into a separate deploy job with
needs: build-deploy that only runs on push/schedule/dispatch.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
ShixiangWang added a commit that referenced this pull request Oct 9, 2026
The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>
ShixiangWang added a commit that referenced this pull request Oct 9, 2026
* fix: require github-pages environment for deploy-pages job

The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: move Pages deploy to dedicated job gated on non-PR events

The github-pages environment protection rules only allow deployments
from main (and legacy gh-pages), so a job targeting the environment
fails on pull_request events (ref refs/pull/<n>/merge) before any
step runs. Split the deploy steps into a separate deploy job with
needs: build-deploy that only runs on push/schedule/dispatch.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: resolve build warnings from the website render pipeline

- ManhattanPlot.qmd / ManhattanPlot.zh.qmd: restore the mangled opening
  fence of the {#fig-HistApplications} div (was a bare "fig-HistApplications}"
  line, leaking a literal closing ::: that triggered Quarto's fenced-div
  warning and rendered stray text on the page)
- index.qmd: point template links at the rendered .html files; the .qmd
  hrefs produced "Unable to resolve link target" warnings on every render
  (rendered output is unchanged - Quarto rewrites both to the same URL)
- workflows: drop the vestigial "Cache R packages" step; its renv paths
  never exist on the runner, so every run logged a cache path validation
  error and the cache was never saved. R packages are already cached by
  the r-lib/actions/setup-r-dependencies composite action
- update-dependencies.R: print warnings as they occur (options(warn=1))
  so the recurring "There were 13 warnings" session summary becomes
  actionable in CI logs

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
ShixiangWang added a commit that referenced this pull request Oct 9, 2026
#311)

* fix: require github-pages environment for deploy-pages job

The first deploy-pages run on main (merge of #308, run
37889595653) failed at "Deploy to GitHub Pages" with:

  HttpError: Missing environment. Ensure your workflow's
  deployment job has an environment.

actions/deploy-pages requires the deployment job to target the
github-pages environment; the legacy quarto publish gh-pages target
never needed one, so neither workflow declared it. Add
environment.name: github-pages to both build-deploy jobs.

Refs: #306

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: move Pages deploy to dedicated job gated on non-PR events

The github-pages environment protection rules only allow deployments
from main (and legacy gh-pages), so a job targeting the environment
fails on pull_request events (ref refs/pull/<n>/merge) before any
step runs. Split the deploy steps into a separate deploy job with
needs: build-deploy that only runs on push/schedule/dispatch.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix: resolve build warnings from the website render pipeline

- ManhattanPlot.qmd / ManhattanPlot.zh.qmd: restore the mangled opening
  fence of the {#fig-HistApplications} div (was a bare "fig-HistApplications}"
  line, leaking a literal closing ::: that triggered Quarto's fenced-div
  warning and rendered stray text on the page)
- index.qmd: point template links at the rendered .html files; the .qmd
  hrefs produced "Unable to resolve link target" warnings on every render
  (rendered output is unchanged - Quarto rewrites both to the same URL)
- workflows: drop the vestigial "Cache R packages" step; its renv paths
  never exist on the runner, so every run logged a cache path validation
  error and the cache was never saved. R packages are already cached by
  the r-lib/actions/setup-r-dependencies composite action
- update-dependencies.R: print warnings as they occur (options(warn=1))
  so the recurring "There were 13 warnings" session summary becomes
  actionable in CI logs

Co-Authored-By: Claude Code <noreply@anthropic.com>

* perf: deduplicate zh figures and drop source maps from deploy artifact

Phase 1 of issue #306: shrink the deployed site (current artifact
~318 MB) without touching rendered content.

- Rewrite zh figure references to share the English figure trees
  (.github/scripts/rewrite-zh-figure-refs.py). The previous
  "Fix zh page figure files" step copied every English <name>_files/
  tree into the zh output directory (~80 MB of duplicated PNGs in the
  artifact); the new step rewrites each *.zh_files/ reference to the
  relative path of the identical existing English figure. References
  without an English counterpart are left untouched and counted.
- Delete *.map source maps from _site before upload. They are
  browser-devtools-only files and have no effect on the rendered site.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: Claude Code <noreply@anthropic.com>
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.

1 participant