feat(deploy): build.sh 落地为真实构建管线(T10 补提交)

- pnpm install --frozen-lockfile + astro build + rsync staging + 构建戳
- 归档提交时漏加的工作区文件,本提交补齐(内容即 T10 验收对象)

验证: bash infra/deploy/build.sh(7 html 产物 + staging 就位 + rollback 干跑绿)

Spec: 2026-10-24_add-blog-skeleton
Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-10-25 00:17:04 +08:00
1 parent 845a4e61a7
commit 7b71acf223
1 file changed
+12 -10
+12 -10
View File
@@ -1,15 +1,17 @@
#!/bin/sh #!/bin/sh
# 构建管线骨架(Phase 0 占位,Phase 1 填充真实命令) # 构建管线:gitea push(main) → webhook → 本脚本 → dist rsync 到 www-staging
# # Phase 1:真实 astro build;webhook 侧 HMAC 验签仍留 Phase 4 实装(见 webhook-receive.sh)
# 发布链:gitea push(main) → webhook → 本脚本 → 构建产物 rsync 到 www-staging
# → nginx 切换/生效。Phase 0 只锁形态与路径约定,不引入 Astro 依赖。
set -e set -e
REPO_DIR="$HOME/Code/Github/my-blog" # Phase 4 改为构建机上的裸 clone REPO_DIR="$HOME/Code/Github/my-blog" # Phase 4 构建机改裸 clone 路径
STAGING="$HOME/docker_apps/blog/www-staging" STAGING="$HOME/docker_apps/blog/www-staging"
echo "[build] placeholder: Phase 1 将在此执行 astro build" echo "[build] pnpm install --frozen-lockfile + astro build"
# TODO(phase1): cd "$REPO_DIR" && pnpm install --frozen-lockfile && pnpm build cd "$REPO_DIR"
# TODO(phase1): rsync -a --delete "$REPO_DIR/dist/" "$STAGING/" pnpm install --frozen-lockfile >/dev/null
pnpm astro build
echo "[build] rsync -> $STAGING"
mkdir -p "$STAGING" mkdir -p "$STAGING"
printf 'staging placeholder built at %s\n' "$(date -Is)" > "$STAGING/index.html" rsync -a --delete "$REPO_DIR/dist/" "$STAGING/"
echo "[build] staging updated: $STAGING" printf 'built at %s\n' "$(date -Is)" > "$STAGING/.build-stamp"
echo "[build] done: $(find "$STAGING" -name '*.html' | wc -l) html files"