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"