webadmin端增加版本号和部署功能

This commit is contained in:
2026-07-12 13:52:22 +08:00
parent 63af3321dd
commit d271ac5b13
16 changed files with 329 additions and 5 deletions
+3
View File
@@ -16,3 +16,6 @@ DEPLOY_LOCK_FILE=/var/run/dukang-deploy.lock
# Prisma db push 遇到 schema 变更警告时自动继续(开发/测试环境可开)
PRISMA_ACCEPT_DATA_LOSS=true
# 注意:Admin「发布更新」读取的是 server/dukang-api/.env.production 中的
# DEPLOY_WEBHOOK_URL / DEPLOY_WEBHOOK_SECRET,须与下方 DEPLOY_WEBHOOK_SECRET 一致
+2
View File
@@ -100,6 +100,8 @@ APP_ROOT="$APP_ROOT"
GIT_REMOTE="$GIT_REMOTE"
GIT_BRANCH="$GIT_BRANCH"
RELEASE_ARGS="$REMOTE_RELEASE_ARGS"
export DEPLOY_TRIGGER=manual
export APP_ROOT
cd "\$APP_ROOT"
+6
View File
@@ -92,4 +92,10 @@ curl -sf -o /dev/null -w "api: %{http_code}\n" http://127.0.0.1:8090/api/v1/heal
|| curl -sf -o /dev/null -w "api: %{http_code}\n" http://127.0.0.1:8090/ \
|| echo "api: FAIL"
echo "==> 7. 记录系统版本"
cd "$APP_ROOT/server/dukang-api"
APP_ROOT="$APP_ROOT" DEPLOY_TRIGGER="${DEPLOY_TRIGGER:-manual}" \
node scripts/with-api-env.cjs node scripts/record-system-version.cjs \
|| echo "WARN: system_version 写入失败"
echo "==> 发版完成"
+4 -1
View File
@@ -121,13 +121,16 @@ const server = http.createServer(async (req, res) => {
});
}
const started = triggerRelease(ref || 'manual');
const source = typeof payload.source === 'string' ? payload.source : '';
const trigger = source === 'admin' ? 'admin' : ref || 'manual';
const started = triggerRelease(trigger);
return json(res, 202, {
ok: true,
accepted: true,
started,
message: started ? 'deploy started' : 'deploy debounced (duplicate webhook)',
ref: ref || ALLOWED_REF,
source: trigger,
});
});