Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/pages-build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions docs/explorations/2026-11-02-pages-redirector-paths.md
Original file line number Diff line number Diff line change
@@ -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 条通过。
Loading