feat: 移除按 SHA 生成标签的处理

This commit is contained in:
2026-01-13 16:59:37 +08:00
parent 41a736e6c7
commit c73f76f877
+2 -6
View File
@@ -153,10 +153,8 @@ build_and_push() {
elif [ -n "${CI_COMMIT_BRANCH:-}" ]; then
if [ "$CI_COMMIT_BRANCH" = "main" ] || [ "$CI_COMMIT_BRANCH" = "master" ]; then
# 主干分支
local short_sha=$(echo "$CI_COMMIT_SHA" | cut -c1-8)
build_args="-t $SWR_REPO:latest -t $SWR_REPO:$short_sha"
build_args="-t $SWR_REPO:latest"
track_image "$SWR_REPO:latest"
track_image "$SWR_REPO:$short_sha"
elif is_semver_like "$CI_COMMIT_BRANCH" && echo "$CI_COMMIT_BRANCH" | grep -q '\.'; then
# 语义化分支 → 生成带 v 的多级标签; 仅当包含 '.' 时才生成多级标签(如 v1.2.3 → v1.2, v1
TAGS=$(generate_version_tags "$CI_COMMIT_BRANCH" "$SWR_REPO")
@@ -169,10 +167,8 @@ build_and_push() {
else
# 普通分支或纯数字(如 12, feature-x)→ 单标签 + sha
local safe_branch=$(sanitize_label "$CI_COMMIT_BRANCH")
local short_sha=$(echo "$CI_COMMIT_SHA" | cut -c1-8)
build_args="-t $SWR_REPO:$safe_branch -t $SWR_REPO:$short_sha"
build_args="-t $SWR_REPO:$safe_branch"
track_image "$SWR_REPO:$safe_branch"
track_image "$SWR_REPO:$short_sha"
fi
echo ""