chore: 更新部署脚本 deploy-docker.sh
Some checks failed
Build and Push Backend / docker (push) Failing after 5s

This commit is contained in:
irving
2025-11-04 22:04:23 -05:00
parent 0b7e86cfa3
commit 2857f2057d

View File

@@ -7,9 +7,9 @@ cd "$SCRIPT_DIR"
prompt_yes_no() {
local prompt="$1"
local default_no_text="${2:-[y/N]}"
local choice_hint="${2:-[y/N]}"
local answer
read -r -p "$prompt $default_no_text " answer || true
read -r -p "$prompt $choice_hint " answer || true
answer="${answer:-}"; answer="${answer,,}"
[[ "$answer" == "y" || "$answer" == "yes" ]]
}
@@ -27,15 +27,20 @@ if [[ "$CURRENT_BRANCH" != "master" ]]; then
exit 1
fi
if ! prompt_yes_no "你跑测试了吗?要不要我帮你跑?"; then
echo "跳过测试执行。"
if prompt_yes_no "你跑测试了吗?确认已跑请输入 y"; then
echo "已确认测试执行完毕。"
else
echo "开始执行测试: mvn test"
if ! mvn test; then
echo "测试未通过,部署流程终止。"
if prompt_yes_no "需要我帮你跑测试吗?"; then
echo "开始执行测试: mvn test"
if ! mvn test; then
echo "测试未通过,部署流程终止。"
exit 1
fi
echo "测试通过。"
else
echo "错误: 未执行测试,部署流程终止。"
exit 1
fi
echo "测试通过。"
fi
if ! prompt_yes_no "你备份数据库了吗?确认已备份请输入 y"; then
@@ -53,6 +58,11 @@ if ! git -C "$SCRIPT_DIR" diff --quiet; then
exit 1
fi
if [[ -n "$(git -C "$SCRIPT_DIR" ls-files --others --exclude-standard)" ]]; then
echo "错误: 检测到未跟踪的文件,请清理或加入版本控制后再试。"
exit 1
fi
if ! git -C "$SCRIPT_DIR" diff --cached --quiet; then
echo "错误: 检测到未提交的暂存修改,请提交后再试。"
exit 1