Skip to content

Commit f5f7610

Browse files
authored
fix: auto-bump patch version in release workflow (#4)
Previously, when the Release workflow was triggered by workflow_run (after CI completes on main), it would skip the release if the current version tag already existed. This required manual version bumps before each release. Now, when triggered by workflow_run: - If current version tag doesn't exist → release with current version - If current version tag exists → auto-bump patch version, update Cargo.toml, then release This makes releases fully automatic after merging PRs to main.
1 parent 24e05d6 commit f5f7610

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ jobs:
108108
109109
# Check if this version tag already exists
110110
if git tag -l "v$CURRENT_VERSION" | grep -q .; then
111-
echo "Tag v$CURRENT_VERSION already exists, skipping release"
112-
echo "should_release=false" >> $GITHUB_OUTPUT
111+
echo "Tag v$CURRENT_VERSION already exists, auto-bumping patch version"
112+
# Auto-bump patch version
113+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
114+
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
115+
echo "Auto-bumped to: $NEW_VERSION"
116+
echo "should_release=true" >> $GITHUB_OUTPUT
117+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
118+
echo "needs_bump=true" >> $GITHUB_OUTPUT
113119
else
114120
echo "New version v$CURRENT_VERSION detected, will release"
115121
echo "should_release=true" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)