From 7b71acf223149d6448e941aae5fd713f22516c42 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sun, 25 Oct 2026 00:17:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(deploy):=20build.sh=20=E8=90=BD=E5=9C=B0?= =?UTF-8?q?=E4=B8=BA=E7=9C=9F=E5=AE=9E=E6=9E=84=E5=BB=BA=E7=AE=A1=E7=BA=BF?= =?UTF-8?q?=EF=BC=88T10=20=E8=A1=A5=E6=8F=90=E4=BA=A4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- infra/deploy/build.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/infra/deploy/build.sh b/infra/deploy/build.sh index 368beba..1499df7 100644 --- a/infra/deploy/build.sh +++ b/infra/deploy/build.sh @@ -1,15 +1,17 @@ #!/bin/sh -# 构建管线骨架(Phase 0 占位,Phase 1 填充真实命令) -# -# 发布链:gitea push(main) → webhook → 本脚本 → 构建产物 rsync 到 www-staging -# → nginx 切换/生效。Phase 0 只锁形态与路径约定,不引入 Astro 依赖。 +# 构建管线:gitea push(main) → webhook → 本脚本 → dist rsync 到 www-staging +# Phase 1:真实 astro build;webhook 侧 HMAC 验签仍留 Phase 4 实装(见 webhook-receive.sh) 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" -echo "[build] placeholder: Phase 1 将在此执行 astro build" -# TODO(phase1): cd "$REPO_DIR" && pnpm install --frozen-lockfile && pnpm build -# TODO(phase1): rsync -a --delete "$REPO_DIR/dist/" "$STAGING/" +echo "[build] pnpm install --frozen-lockfile + astro build" +cd "$REPO_DIR" +pnpm install --frozen-lockfile >/dev/null +pnpm astro build + +echo "[build] rsync -> $STAGING" mkdir -p "$STAGING" -printf 'staging placeholder built at %s\n' "$(date -Is)" > "$STAGING/index.html" -echo "[build] staging updated: $STAGING" +rsync -a --delete "$REPO_DIR/dist/" "$STAGING/" +printf 'built at %s\n' "$(date -Is)" > "$STAGING/.build-stamp" +echo "[build] done: $(find "$STAGING" -name '*.html' | wc -l) html files"