Skip to content

Commit db4a30f

Browse files
committed
fix(ci): skip tag/branch creation when MINOR tag already exists
1 parent 8b1b188 commit db4a30f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/scripts/release.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ DRYRUN=$2
88

99
BRANCH=$(git branch --show-current)
1010
RELEASE_BRANCH=
11+
SKIP_RELEASE_CREATION=false
1112

1213
BASE=$(./gradlew printVersion -Psnapshot=false | grep 'Version:' | cut -f2 -d' ')
1314
# BASE == 0.0.1
@@ -52,7 +53,12 @@ if [ "$TYPE" == "MINOR" ] || [ "$TYPE" == "MAJOR" ]; then
5253
# BASE == 1.0.0
5354
fi
5455
RELEASE_BRANCH="release/${BASE%.*}._"
55-
create_annotated_tag "$BASE" "$TYPE" "$BRANCH"
56+
if [ -z "$DRYRUN" ] && git rev-parse "v_${BASE}" >/dev/null 2>&1; then
57+
echo "Tag v_${BASE} already exists; skipping tag and release branch creation — will only produce a version-bump PR"
58+
SKIP_RELEASE_CREATION=true
59+
else
60+
create_annotated_tag "$BASE" "$TYPE" "$BRANCH"
61+
fi
5662
fi
5763

5864
if [ "$TYPE" == "PATCH" ]; then
@@ -106,7 +112,7 @@ if [ "$TYPE" == "RETAG" ]; then
106112
exit 0
107113
fi
108114

109-
if [ "$BRANCH" != "$RELEASE_BRANCH" ]; then
115+
if [ "$SKIP_RELEASE_CREATION" == "false" ] && [ "$BRANCH" != "$RELEASE_BRANCH" ]; then
110116
git checkout -b $RELEASE_BRANCH
111117
if ! git diff --quiet; then
112118
git add build.gradle.kts

0 commit comments

Comments
 (0)