diff --git a/.github/workflows/pages-build-site.yml b/.github/workflows/pages-build-site.yml index cd1cc4648..cb9c4e6c0 100644 --- a/.github/workflows/pages-build-site.yml +++ b/.github/workflows/pages-build-site.yml @@ -3,12 +3,15 @@ on: # The editor now lives at https://edit.chaxus.com (Cloudflare Pages). # GitHub Pages publishes ONLY a client-side redirector (redirect/), so old # ranuts.github.io/document/* links keep working (path + query preserved). - # The app now deploys to Cloudflare Pages from `main`, so GitHub Pages is - # main-based too: any push to main republishes the redirector. workflow_dispatch - # lets you trigger the first redirector deploy by hand once Cloudflare is live. + # GitHub Pages keeps serving the last published artifact, so the redirector + # only needs republishing when it changes; every other push to main used to + # redeploy the same two files. workflow_dispatch republishes by hand. push: branches: - main + paths: + - "redirect/**" + - ".github/workflows/pages-build-site.yml" workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages diff --git a/docs/explorations/2026-11-02-pages-redirector-paths.md b/docs/explorations/2026-11-02-pages-redirector-paths.md new file mode 100644 index 000000000..e040f3033 --- /dev/null +++ b/docs/explorations/2026-11-02-pages-redirector-paths.md @@ -0,0 +1,14 @@ +# GitHub Pages 跳转页不再每次推送都重新发布 + +`pages-build-site.yml` 只负责把 `redirect/`(`index.html` + `404.html`)发布到 GitHub Pages, +让旧的 `ranuts.github.io/document/*` 链接带着路径和参数跳到 edit.chaxus.com。 + +它原来对 main 的每一次推送都跑一遍,于是仓库的 Deployments 页面堆了上百条 `github-pages` 记录: +2026-08 到 2026-11 共 100 次,而 `redirect/` 自 2026-07-05 上线后只改过一次。 +GitHub Pages 会一直托管最后一次发布的产物,重复发布同样两个文件没有任何作用。 + +改动:`push` 触发加 `paths`,只有 `redirect/**` 或这个 workflow 文件本身变化时才发布,保留 `workflow_dispatch` 手动发布。 +**不能关掉 GitHub Pages**:关掉之后旧链接就没有跳转页了。 + +验证:2026-11-02 `curl https://ranuts.github.io/document/` 返回的就是当前 `redirect/index.html`, +说明最后一次发布的产物仍在托管。`workflow-contract.test.ts` 68 条通过。