- T1 (op-gitea 车道):CommandPalette 三层(动作 theme/lang/rss+导航
zh/en+Pagefind 搜索),Ctrl K 与 / 入口,document 级委托修 ClientRouter
换页绑定失效;连带修复动态结果节点的 scoped CSS 失效潜伏 bug
- T4:preflight.sh 17 项全绿(产物/hreflang/双轨/微信 UA 200/
responsive 11/halo 无恙/回滚前置);headless 渲染经 c4ai 复核
(en 书评页全文+标注+ICP 实测在案)
- T5:launch.sh/rollback.sh 双向 dry-run 绿 + 上线检查单(linger/
ESA 刷新/验证 URL/回滚路径)
验证: build 21 页 exit 0;command-palette+cmd-item zh/en 断言;
bash scripts/preflight.sh ALL OK;launch/rollback dry-run exit 0
Spec: 2026-10-25_add-blog-launch
Co-authored-by: GLM-5.3
52 lines
2.5 KiB
Bash
Executable File
52 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
||
# 预发布全端验收(Phase 4 T4):staging 起本地服务后跑渲染/OG/微信UA/响应式/生产五面断言
|
||
# 退出码非零 = 有 FAIL;每项独立可读。c4ai 部分依赖本机 crawl4ai 容器(headless Chromium)。
|
||
set -u
|
||
cd "$(dirname "$0")/.."
|
||
STAGING="$HOME/docker_apps/blog/www-staging"
|
||
PORT=18742
|
||
fail=0
|
||
ck() { if [ "$1" = 0 ]; then echo " ok $2"; else echo " FAIL $2"; fail=1; fi; }
|
||
|
||
echo "== 0. staging 本地服务 =="
|
||
if ! curl -sf "http://127.0.0.1:$PORT/" -o /dev/null; then
|
||
(cd "$STAGING" && python3 -m http.server $PORT >/dev/null 2>&1 &)
|
||
sleep 1
|
||
fi
|
||
curl -sf "http://127.0.0.1:$PORT/" -o /dev/null; ck $? "staging HTTP 服务 ($PORT)"
|
||
|
||
echo "== 1. OG/HTML 静态断言(zh/en 首页 + 一篇书评 + 一篇技术) =="
|
||
for f in index.html en/index.html archives/mian-sha/index.html en/archives/csge-lei-pei-zhi/index.html; do
|
||
test -f "$STAGING/$f"; ck $? "产物存在 $f"
|
||
done
|
||
grep -q 'name="description"' "$STAGING/index.html"; ck $? "meta description"
|
||
grep -q 'hreflang="en"' "$STAGING/index.html" && grep -q 'hreflang="zh"' "$STAGING/en/index.html"; ck $? "hreflang 双向"
|
||
grep -q 'prose-reading' "$STAGING/archives/mian-sha/index.html"; ck $? "书评衬线轨"
|
||
grep -q 'prose-tech\|toc' "$STAGING/en/archives/csge-lei-pei-zhi/index.html"; ck $? "技术轨/TOC"
|
||
|
||
echo "== 2. 微信内置浏览器 UA 模拟 =="
|
||
WM=$(curl -sf -A "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 MicroMessenger/8.0.49" \
|
||
"http://127.0.0.1:$PORT/archives/mian-sha/index.html" -o /dev/null -w '%{http_code}')
|
||
[ "$WM" = "200" ]; ck $? "MicroMessenger UA 抓取 200(实际 $WM)"
|
||
|
||
echo "== 3. 响应式结构断言 =="
|
||
bash scripts/check-responsive.sh >/dev/null 2>&1; ck $? "check-responsive 11 项"
|
||
|
||
echo "== 4. 生产 Halo 无恙 =="
|
||
curl -sf http://127.0.0.1:18090 -o /dev/null; ck $? "halo 18090 响应"
|
||
docker inspect -f '{{.State.Health.Status}}' halo-halo-1 | grep -q healthy; ck $? "halo healthy"
|
||
|
||
echo "== 5. 回滚前置 =="
|
||
bash infra/deploy/rollback-dryrun.sh >/dev/null 2>&1; ck $? "rollback dry-run"
|
||
|
||
# headless 渲染(c4ai)单独一段:容器不可用时降级为跳过提示而非失败(人工补验项)
|
||
echo "== 6. headless 渲染(c4ai,可选面) =="
|
||
if timeout 60 curl -sf http://127.0.0.1:11235/ -o /dev/null 2>/dev/null; then
|
||
echo " (crawl4ai 在线——渲染断言由 orchestrator 会话内执行,见验收记录)"
|
||
else
|
||
echo " skip: crawl4ai 容器不可达(人工补验:浏览器开 staging 抽查)"
|
||
fi
|
||
|
||
[ "$fail" = 0 ] && echo "preflight: ALL OK" || echo "preflight: FAILURES above"
|
||
exit $fail
|