Merge pull request 'docs: 修正生产部署运行时命令' (#13)

Use commands compatible with the production Git and build the frontend under Node.js 22.
This commit is contained in:
lunanting 2026-09-17 11:46:14 +08:00
commit 611165dded

View File

@ -112,15 +112,18 @@ test "$(git rev-parse "origin/main^{commit}")" = "$DEPLOY_SHA" || {
exit 1
}
git switch main
git checkout main
git pull --ff-only origin main
test "$(git rev-parse HEAD)" = "$DEPLOY_SHA" || {
echo '服务器 HEAD 与待部署 SHA 不一致,停止部署'
exit 1
}
npm --prefix frontend ci
npm --prefix frontend run build
docker run --rm \
-v /opt/cangku/app/frontend:/workspace \
-w /workspace \
node:22-bookworm-slim \
sh -lc 'npm ci && npm run build'
if grep -q '^SOURCE_GIT_SHA=' /opt/cangku/shared/backend.env; then
sed -i "s/^SOURCE_GIT_SHA=.*/SOURCE_GIT_SHA=$DEPLOY_SHA/" /opt/cangku/shared/backend.env
else