From 3958928a9aac8de61d577392aa206fe157ffbf24 Mon Sep 17 00:00:00 2001 From: Rishi Tank Date: Mon, 5 Jan 2026 22:02:52 +0000 Subject: [PATCH] fix: auto-bump patch version when tag exists in workflow_run trigger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2c87cf..9f74c6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,8 +108,14 @@ jobs: # Check if this version tag already exists if git tag -l "v$CURRENT_VERSION" | grep -q .; then - echo "Tag v$CURRENT_VERSION already exists, skipping release" - echo "should_release=false" >> $GITHUB_OUTPUT + echo "Tag v$CURRENT_VERSION already exists, auto-bumping patch version" + # Auto-bump patch version + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" + echo "Auto-bumped to: $NEW_VERSION" + echo "should_release=true" >> $GITHUB_OUTPUT + echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "needs_bump=true" >> $GITHUB_OUTPUT else echo "New version v$CURRENT_VERSION detected, will release" echo "should_release=true" >> $GITHUB_OUTPUT