File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,6 +60,16 @@ if [ "$TYPE" == "PATCH" ]; then
6060 echo " Patch release can be created only for 'release/*' branch."
6161 exit 1
6262 fi
63+ # First patch after a minor/major release: the current version is already tagged.
64+ # Pre-increment the patch so we tag the next version (e.g. 1.40.0 -> 1.40.1).
65+ if git rev-parse " v_${BASE} " > /dev/null 2>&1 ; then
66+ if [ -z " $DRYRUN " ]; then
67+ ./gradlew incrementVersion --versionIncrementType=PATCH
68+ BASE=$( ./gradlew printVersion -Psnapshot=false | grep ' Version:' | cut -f2 -d' ' )
69+ else
70+ echo " [DRY-RUN] Version $BASE is already tagged; would pre-increment patch before tagging"
71+ fi
72+ fi
6373 RELEASE_BRANCH=" release/${BASE% .* } ._"
6474 create_annotated_tag " $BASE " " $TYPE " " $BRANCH "
6575fi
Original file line number Diff line number Diff line change @@ -105,8 +105,14 @@ jobs:
105105 RELEASE_VERSION="$BASE"
106106 fi
107107 else
108- # PATCH always increments
109- RELEASE_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
108+ # PATCH: increment only when the current version is already tagged
109+ # (first patch after a minor/major release); subsequent patches start
110+ # from the already-bumped dev version in build.gradle.kts.
111+ if [ "$ALREADY_RELEASED" == "true" ]; then
112+ RELEASE_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
113+ else
114+ RELEASE_VERSION="$BASE"
115+ fi
110116 fi
111117
112118 # Compute release branch
You can’t perform that action at this time.
0 commit comments