Skip to content

Commit 4f082b5

Browse files
ci: 取消发布ci版本
1 parent 86bc70d commit 4f082b5

1 file changed

Lines changed: 19 additions & 38 deletions

File tree

.github/workflows/install.yml

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
tags:
66
- "v*"
77
branches:
8-
- main # 正式版分支
9-
- beta # 公测版分支
8+
- main
9+
- beta
1010
paths:
1111
- ".github/workflows/install.yml"
1212
- "assets/**"
@@ -37,46 +37,27 @@ jobs:
3737
run: |
3838
current_branch=${{ github.ref_name }}
3939
is_release=${{ startsWith(github.ref, 'refs/tags/v') }}
40-
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true)
41-
42-
# 初始标签获取逻辑
43-
if [[ $tag != v* ]]; then
44-
tag=$(curl -sX GET "https://api.github.com/repos/${{ github.repository }}/releases/latest" --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | awk -F'"' '/tag_name/{print $4}')
45-
if [[ $tag != v* ]]; then
46-
tag="v0.0.0"
47-
fi
48-
tag=$(date "+$tag-%y%m%d-$(git rev-parse --short HEAD)")
49-
fi
5040
51-
# 分支逻辑处理
52-
if [[ "$current_branch" == "beta" ]]; then
53-
# Beta 分支自动递增序号
54-
if [[ "$is_release" == "false" ]]; then
55-
latest_beta_tag=$(git describe --tags --match "v*-beta.*" --abbrev=0 2>/dev/null || true)
56-
if [[ -z "$latest_beta_tag" ]]; then
57-
latest_main_tag=$(git describe --tags --match "v*" --abbrev=0 2>/dev/null || echo "v0.0.0")
58-
base_version=$(echo "$latest_main_tag" | sed 's/-.*//')
59-
new_tag="${base_version}-beta.1"
60-
else
61-
base_version=$(echo "$latest_beta_tag" | cut -d'-' -f1)
62-
beta_num=$(echo "$latest_beta_tag" | awk -F'.' '{print $NF}')
63-
new_tag="${base_version}-beta.$((beta_num + 1))"
64-
fi
65-
tag="$new_tag"
41+
if [[ "$is_release" == "true" ]]; then
42+
tag=$(git describe --tags --exact-match ${{ github.ref }})
43+
44+
# 分支标签格式校验
45+
if [[ "$current_branch" == "main" ]] && [[ "$tag" == *-beta* ]]; then
46+
echo "::error::Main branch cannot have beta tags"
47+
exit 1
48+
elif [[ "$current_branch" == "beta" ]] && [[ "$tag" != *-beta* ]]; then
49+
echo "::error::Beta branch tags must contain '-beta' suffix"
50+
exit 1
6651
fi
67-
is_prerelease=true
6852
69-
elif [[ "$current_branch" == "main" ]]; then
70-
# Main 分支清理 beta 后缀
71-
tag=$(echo "$tag" | sed 's/-beta.*//')
7253
is_prerelease=false
73-
fi
74-
75-
# 非 Release 标签添加 CI 后缀
76-
if [[ "$is_release" == "false" ]]; then
77-
prefix=${tag%-*-*}
78-
suffix=${tag#$prefix-}
79-
tag="$prefix-ci.$suffix"
54+
if [[ "$tag" == *-beta* ]]; then
55+
is_prerelease=true
56+
fi
57+
else
58+
tag=""
59+
is_release="false"
60+
is_prerelease="false"
8061
fi
8162
8263
echo "tag=$tag" | tee -a $GITHUB_OUTPUT

0 commit comments

Comments
 (0)