Skip to content

Commit 3b0a29f

Browse files
jbachorikclaude
andcommitted
Fix release workflow version increment logic
Only increment version if already released, otherwise use base version. Fixes issue where MINOR release from X.Y.0-SNAPSHOT created X.Y+1.0 instead of X.Y.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 75f6536 commit 3b0a29f

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

.github/workflows/release-validated.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,30 @@ jobs:
8282
exit 1
8383
fi
8484
85+
# Check if this version is already released
86+
if git rev-parse "v_${BASE}" >/dev/null 2>&1; then
87+
ALREADY_RELEASED=true
88+
echo "Version $BASE is already released"
89+
else
90+
ALREADY_RELEASED=false
91+
echo "Version $BASE is not yet released"
92+
fi
93+
8594
# Compute release version based on type
8695
if [ "$TYPE" == "MAJOR" ] || [ "$TYPE" == "major" ]; then
87-
RELEASE_VERSION="$((MAJOR + 1)).0.0"
96+
if [ "$ALREADY_RELEASED" == "true" ]; then
97+
RELEASE_VERSION="$((MAJOR + 1)).0.0"
98+
else
99+
RELEASE_VERSION="$BASE"
100+
fi
88101
elif [ "$TYPE" == "MINOR" ] || [ "$TYPE" == "minor" ]; then
89-
RELEASE_VERSION="$MAJOR.$((MINOR + 1)).0"
102+
if [ "$ALREADY_RELEASED" == "true" ]; then
103+
RELEASE_VERSION="$MAJOR.$((MINOR + 1)).0"
104+
else
105+
RELEASE_VERSION="$BASE"
106+
fi
90107
else
108+
# PATCH always increments
91109
RELEASE_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
92110
fi
93111

0 commit comments

Comments
 (0)