Repository navigation
Release automatically when the version changes - #10
Merged
Merged
Conversation
Add a release job to the CI workflow: after the tests pass on a push to the default branch it reads lib/ipdata/version.rb and, when tag v<version> does not exist, creates the tag and the GitHub release. A tag created with the workflow token starts no other workflow, so a publish job in the same run calls the release workflow, which gains a workflow_call trigger with a tag input and checks that tag out. The manual bump run and a pushed tag publish as before. Document the process in the README. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merging a pull request that bumps
VERSIONinlib/ipdata/version.rbis now enough to tag the merge commit, create the GitHub release and publish the gem to RubyGems. No manual tagging is needed. The manual Publish to RubyGems run (bumpinput) and a pushedv*tag keep working as before.How it works
ci.ymlgains areleasejob that runs only on a push to the default branch, after the whole test matrix succeeds (permissions: contents: write, concurrency grouprelease). It reads the version fromlib/ipdata/version.rb, checksgit ls-remote --exit-code --tags origin refs/tags/v<version>and, when the tag is missing (exit status 2), runsgh release create v<version> --target $GITHUB_SHA --title v<version> --generate-noteswith the workflow token. When the tag exists it does nothing and says so, so the current0.2.0, which is already tagged, is not released again. The job exposes the outputstagandcreated.GITHUB_TOKENdoes not trigger other workflows, so apublishjob in the same run (needs: release,if: needs.release.outputs.created == 'true',contents: writeandid-token: write) callsrelease.ymlas a reusable workflow with that tag.release.ymlgains anon: workflow_calltrigger with a requiredtaginput. Itsreleasejob also runs when that input is set and then checks outrefs/tags/<tag>; a manual bump run still checks outmainand a tag push still checks out the pushed tag. The publish steps (tests,rubygems/release-gem@v1with trusted publishing) are unchanged and exist once, inrelease.yml, so the RubyGems trusted publisher configured for that file keeps matching.Verification
actionlint(with shellcheck) reports no errors.0.2.0for the checked-outlib/ipdata/version.rb.originwith a stubgh: for0.2.0it reports thatv0.2.0exists and setscreated=false; for an untagged version it invokesgh release create v9.9.9 --target <sha> --title v9.9.9 --generate-notesand setscreated=true; an unreadable version fails the step..github/and the README changed.releasejob cannot run before this is merged. Its first run after the merge should report thatv0.2.0already exists and publish nothing.🤖 Generated with Claude Code