From 3f979e57a511bb4051cbcbc8c761b791f8cc2db2 Mon Sep 17 00:00:00 2001 From: Liuyf Date: Tue, 22 Oct 2024 09:53:12 +0800 Subject: [PATCH] =?UTF-8?q?other=EF=BC=9A=20=E6=96=B0=E5=A2=9Ecanary?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=89=93=E5=8C=85=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tag_generator.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tag_generator.sh b/tag_generator.sh index 61e7fbd6..9fd5997a 100755 --- a/tag_generator.sh +++ b/tag_generator.sh @@ -26,6 +26,7 @@ else compare_json=$(curl -s --header "PRIVATE-TOKEN: $TOKEN" "$URL/projects/$PROJECT_ID/repository/compare?from=master&to=$CI_COMMIT_BRANCH") fi echo "compare_json:$compare_json\n" + new_patch = patch while IFS= read -r commit_json; do # 使用 jq 解析每一行的 JSON 对象 commit_id=$(echo "$commit_json" | jq -r '.id') @@ -33,15 +34,15 @@ else echo "----$commit_message" if [[ "$commit_message" =~ ("feat:"*) ]]; then ((minor++)) - patch=0 + new_patch=0 break - elif [[ "$commit_message" =~ ("fix:"*) ]]; then - ((patch++)) - elif [[ ! "$commit_message" =~ ("Merge"* | "Revert"*) ]]; then - ((patch++)) + elif [[ "$commit_message" =~ ("fix:"*) ]] && [[ new_patch == path ]]; then + ((new_patch++)) + elif [[ ! "$commit_message" =~ ("Merge"* | "Revert"*) ]] && [[ new_patch == path ]]; then + ((new_patch++)) fi done < <(echo "$compare_json" | jq -c '.commits[] | {id: .id, message: .message}') - next_tag="v$major.$minor.$patch" + next_tag="v$major.$minor.$new_patch" fi echo "New Tag:$newest_tag;New version: $next_tag;command: $1" if [[ "$1" == "generate_tag" ]];then