From a72d76522f77d4d4bf60b333da99be4e229d57b7 Mon Sep 17 00:00:00 2001 From: fengsilin Date: Fri, 5 Jun 2026 17:31:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20=E9=83=A8=E7=BD=B2=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=20tag=20=E6=A0=BC=E5=BC=8F=E4=B8=8E=20Makefile=20?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=EF=BC=8C=E5=8A=A0=E5=85=A5=20commit=20hash?= =?UTF-8?q?=20=E5=92=8C=20dirty=20=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy-test.sh | 5 ++++- scripts/deploy.sh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-test.sh b/scripts/deploy-test.sh index 19d32bf..e1cda44 100644 --- a/scripts/deploy-test.sh +++ b/scripts/deploy-test.sh @@ -69,7 +69,10 @@ if [ "$NO_BUILD" = false ]; then cd "$PROJECT_DIR" BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') - TAG="$(date +%Y%m%d%H%M)-${BRANCH}" + COMMIT_SHORT=$(git rev-parse --short HEAD) + GIT_DIRTY="" + git diff --quiet && git diff --cached --quiet 2>/dev/null || GIT_DIRTY="-dirty" + TAG="$(date +%Y%m%d%H%M)-${BRANCH}-${COMMIT_SHORT}${GIT_DIRTY}" IMAGE="${DOCKER_REGISTRY}:${TAG}" info "分支: ${BRANCH}" diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 8abc6bb..e911632 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -72,7 +72,10 @@ if [ "$NO_BUILD" = false ]; then cd "$PROJECT_DIR" BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') - TAG="$(date +%Y%m%d%H%M)-${BRANCH}" + COMMIT_SHORT=$(git rev-parse --short HEAD) + GIT_DIRTY="" + git diff --quiet && git diff --cached --quiet 2>/dev/null || GIT_DIRTY="-dirty" + TAG="$(date +%Y%m%d%H%M)-${BRANCH}-${COMMIT_SHORT}${GIT_DIRTY}" IMAGE="${DOCKER_REGISTRY}:${TAG}" info "分支: ${BRANCH}"