Skip to content

Auto-bump version.rb from release tag#150

Closed
hownowstephen wants to merge 1 commit into
mainfrom
auto-version-bump
Closed

Auto-bump version.rb from release tag#150
hownowstephen wants to merge 1 commit into
mainfrom
auto-version-bump

Conversation

@hownowstephen
Copy link
Copy Markdown
Contributor

@hownowstephen hownowstephen commented May 22, 2026

Summary

  • Replace manual version verification with automatic version injection from git tag
  • After publishing to RubyGems, commit the version bump back to main
  • No more manual version bump PRs — just cut a GitHub Release and everything flows

How it works

  1. Create a GitHub Release with tag vX.Y.Z
  2. Workflow sets VERSION = "X.Y.Z" in version.rb before gem build
  3. Publishes to RubyGems
  4. Commits the version bump back to main

Test plan

  • Verify workflow syntax is valid
  • Cut a test release to confirm end-to-end flow

Note

Medium Risk
Changes the release workflow to rewrite lib/customerio/version.rb from the pushed tag and then push a commit to main, which can fail or cause unintended version bumps if tags/permissions are misconfigured.

Overview
Release workflow now derives the gem version from the pushed v* tag by editing lib/customerio/version.rb before publishing, replacing the previous tag-to-version verification step.

After publishing, it checks out main and commits/pushes the same version bump back to the repository, automating the post-release version update.

Reviewed by Cursor Bugbot for commit a6d62d6. Bugbot is set up for automated code reviews on this repo. Configure here.

Replace manual version verification with automatic injection.
When a GitHub Release creates a v* tag, the workflow now sets
VERSION from the tag before publishing, then commits the bump
back to main.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a6d62d6. Configure here.

tag="${GITHUB_REF#refs/tags/v}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout main
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shallow clone prevents checkout of main branch

High Severity

git checkout main will fail because actions/checkout@v6 with the default fetch-depth: 1 only fetches the single commit for the tag that triggered the workflow. The main branch and its remote tracking ref origin/main are not available in the shallow clone. The checkout step needs either fetch-depth: 0 or an explicit git fetch origin main before switching branches.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6d62d6. Configure here.

exit 1
fi
sed -i "s/VERSION = \".*\"/VERSION = \"$tag\"/" lib/customerio/version.rb
echo "Version set to $tag"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncommitted sed change fails rake release guard_clean check

High Severity

The sed command modifies lib/customerio/version.rb without committing it, leaving a dirty working directory. The subsequent rubygems/release-gem@v1 step runs bundle exec rake release, which invokes Bundler's guard_clean check. This check detects the uncommitted change and aborts, completely preventing gem publication. The project's Rakefile uses standard bundler/gem_tasks with no override of this behavior.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6d62d6. Configure here.

@hownowstephen
Copy link
Copy Markdown
Contributor Author

Not needed — sticking with manual version bump PR flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant