diff --git a/deploy.sh b/deploy.sh index d796bcb..cbf1f6b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -477,7 +477,9 @@ do_deploy() { # ----- 事务前钩子:备份数据库(仅降级时备份) ----- BACKUP_DIR="" - if [ -n "$CURRENT_VERSION" ] && [ "$CURRENT_VERSION" != "0.0.0-dev" ]; then + + # 如果是首次部署,跳过版本比对(因为版本文件不存在) + if [ -n "$CURRENT_VERSION" ] && [ "$CURRENT_VERSION" != "0.0.0-dev" ] && [ "$CURRENT_VERSION" != "(首次部署)" ]; then compare_version "$CURRENT_VERSION" "$TARGET_VERSION" COMPARE_RESULT=$? if [ $COMPARE_RESULT -eq 2 ]; then @@ -508,6 +510,8 @@ do_deploy() { print_warn "部署目录不存在,跳过备份" fi fi + else + print_info "首次部署,跳过版本比对" fi # ----- 安装必要工具(必须在拉取代码之前!)-----