fix(ci): CDN 刷新清单改为「固定入口页 + 本次改动过的内容页」
又拍云对 HTML 的 max-age 是 8 天,而流水线只刷固定白名单(/ sitemap rss archives posts comment links)。不在清单里的页面改动后,源站已更新、CDN 仍发 旧副本——本次 about.html 就卡住了(源站 47935B 含新板块,CDN 仍是 41454B)。 - 新增 scripts/purge_list.js:读 git diff 找出改动的 content/*.md,按 slug/url/目录名/文件名推输出页,并校验 public/ 下确实存在才加入 - .cnb.yml 刷新步骤改用它,脚本失败时兜底只刷首页 - git diff 必须带 -z / core.quotepath=false,否则非 ASCII 路径会被转义引号包裹, 校验必然失败(本次踩过)
This commit is contained in:
1 parent
ec8d1c45f2
commit
66c27c7b62
2 files changed
+95
-8
No files matched your search
@@ -113,14 +113,21 @@
|
||||
}
|
||||
trap record EXIT
|
||||
|
||||
# ★ 必须刷固定入口页:只刷首页会让 sitemap.xml / rss.xml / archives.html /
|
||||
# posts.html 一直发 CDN 上的旧副本(2026-10-01 实测复现:源站 22812B、
|
||||
# CDN 仍是 7/24 的 22592B,手动 purge 后立刻变新)。
|
||||
{ echo "https://usj.cc/"
|
||||
for p in sitemap.xml rss.xml archives.html posts.html comment.html links.html; do
|
||||
echo "https://usj.cc/$p"
|
||||
done
|
||||
} > /tmp/purge.txt
|
||||
# 刷新清单 = 固定入口页 + 本次改动过的内容页,由 scripts/purge_list.js 生成。
|
||||
#
|
||||
# ★ 为什么必须刷固定入口页:只刷首页会让 sitemap.xml / rss.xml /
|
||||
# archives.html / posts.html 一直发 CDN 上的旧副本(2026-10-01 实测复现:
|
||||
# 源站 22812B、CDN 仍是 7/24 的 22592B,手动 purge 后立刻变新)。
|
||||
# ★ 为什么要动态部分:又拍云对 HTML 的 max-age 是 691200(8 天),
|
||||
# **不在清单里的页面即使源站已更新,CDN 也会发最多 8 天的旧副本**
|
||||
# (2026-10-05 实测:about.html 源站 47935B 已含新板块,CDN 仍发 41454B 旧版)。
|
||||
# 脚本靠 `git diff BASE HEAD` 找出改动的 content/*.md,按 slug/url/文件名
|
||||
# 推出输出页并校验 public/ 下确实存在,避免刷不存在的 URL。
|
||||
# 基线取 HEAD~1;拿不到(浅克隆等)就自动降级为只剩固定入口页。
|
||||
node scripts/purge_list.js > /tmp/purge.txt || true
|
||||
# 兜底:脚本要是整个失败,至少保证固定入口页仍被刷
|
||||
[ -s /tmp/purge.txt ] || printf 'https://usj.cc/\n' > /tmp/purge.txt
|
||||
echo "刷新清单 $(wc -l < /tmp/purge.txt) 条"
|
||||
upx purge --list /tmp/purge.txt
|
||||
|
||||
- name: 刷新多吉云 CDN
|
||||
|
||||
Reference in new issue
Block a user