ci: 发布改用 cp/find,去掉对宿主机 rsync 的依赖

This commit is contained in:
xiaozhou233 committed 2026-10-06 14:49:38 +08:00
1 parent 864b67ef87
commit f52b91e06c
2 files changed
+15 -12

No files matched your search

Vendored
+6 -3
View File
@@ -1,6 +1,6 @@
// =============================================================================
// Jenkins 声明式流水线(容器化构建)
// 流程:Gitea push -> 检出 -> docker 构建 dist -> 导出 -> rsync 到 Nginx 站点目录
// 流程:Gitea push -> 检出 -> docker 构建 dist -> 导出 -> 同步到 Nginx 站点目录
//
// 前置条件(见 README「自动部署(Jenkins)」):
// 1. Jenkins 用户能用 docker(通常在 docker 组里)。
@@ -56,8 +56,11 @@ pipeline {
sh '''
set -euo pipefail
mkdir -p "$DEPLOY_DIR"
# 增量同步;--delete 清掉上次的旧哈希文件;排除 extra/ 带来的占位文件
rsync -az --delete --exclude='.gitkeep' .deploy/ "$DEPLOY_DIR"/
# 清空目标目录内容(等价于 rsync --delete),保持站点干净
find "$DEPLOY_DIR" -mindepth 1 -delete
# 复制构建产物(-a 保留属性);先移除 extra/ 带来的占位文件
find .deploy -name .gitkeep -delete
cp -a .deploy/. "$DEPLOY_DIR"/
echo "✅ Deployed to $DEPLOY_DIR"
'''
}