From db4a30f76cf81e3ff76b50a7bbd894ccb5ec92a5 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 29 May 2026 14:05:53 +0200 Subject: [PATCH] fix(ci): skip tag/branch creation when MINOR tag already exists --- .github/scripts/release.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index ac7d8ec4c..2025d4d8a 100755 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -8,6 +8,7 @@ DRYRUN=$2 BRANCH=$(git branch --show-current) RELEASE_BRANCH= +SKIP_RELEASE_CREATION=false BASE=$(./gradlew printVersion -Psnapshot=false | grep 'Version:' | cut -f2 -d' ') # BASE == 0.0.1 @@ -52,7 +53,12 @@ if [ "$TYPE" == "MINOR" ] || [ "$TYPE" == "MAJOR" ]; then # BASE == 1.0.0 fi RELEASE_BRANCH="release/${BASE%.*}._" - create_annotated_tag "$BASE" "$TYPE" "$BRANCH" + if [ -z "$DRYRUN" ] && git rev-parse "v_${BASE}" >/dev/null 2>&1; then + echo "Tag v_${BASE} already exists; skipping tag and release branch creation — will only produce a version-bump PR" + SKIP_RELEASE_CREATION=true + else + create_annotated_tag "$BASE" "$TYPE" "$BRANCH" + fi fi if [ "$TYPE" == "PATCH" ]; then @@ -106,7 +112,7 @@ if [ "$TYPE" == "RETAG" ]; then exit 0 fi -if [ "$BRANCH" != "$RELEASE_BRANCH" ]; then +if [ "$SKIP_RELEASE_CREATION" == "false" ] && [ "$BRANCH" != "$RELEASE_BRANCH" ]; then git checkout -b $RELEASE_BRANCH if ! git diff --quiet; then git add build.gradle.kts