Add gem release workflow with GitHub release notes from changelog#1815
Open
neilvcarvalho wants to merge 3 commits intomainfrom
Open
Add gem release workflow with GitHub release notes from changelog#1815neilvcarvalho wants to merge 3 commits intomainfrom
neilvcarvalho wants to merge 3 commits intomainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5d54c5d to
17509cf
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17509cf to
d21428b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automated release tooling for the gem, tying version bumps to NEWS.md and generating GitHub Releases from the changelog.
Changes:
- Add a PR workflow that fails when
lib/factory_bot/version.rbis updated without a matchingNEWS.mdsection. - Add a release workflow that publishes the gem via RubyGems trusted publishing (OIDC) and creates a GitHub Release using notes extracted from
NEWS.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/validate-changelog.yml | PR check ensuring NEWS.md has a header for the bumped version. |
| .github/workflows/release.yml | Release automation: extract notes from NEWS.md, publish to RubyGems, then create a GitHub Release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Check NEWS.md contains version section | ||
| run: | | ||
| VERSION=$(ruby -e "require_relative 'lib/factory_bot/version'; puts FactoryBot::VERSION") | ||
| if ! grep -q "^## $VERSION" NEWS.md; then |
| run: | | ||
| VERSION=$(ruby -e "require_relative 'lib/factory_bot/version'; puts FactoryBot::VERSION") | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| NOTES=$(awk "BEGIN{p=0} /^## $VERSION/{p=1; next} p && /^## /{exit} p{print}" NEWS.md) |
Comment on lines
+37
to
+39
| gh release create "v${{ steps.release_notes.outputs.version }}" \ | ||
| --title "v${{ steps.release_notes.outputs.version }}" \ | ||
| --notes "${{ steps.release_notes.outputs.notes }}" |
Comment on lines
+29
to
+31
| echo "notes<<EOF" >> "$GITHUB_OUTPUT" | ||
| echo "$NOTES" >> "$GITHUB_OUTPUT" | ||
| echo "EOF" >> "$GITHUB_OUTPUT" |
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
lib/factory_bot/version.rbchanges onmainand publishes the gem to RubyGems.orgrubygems_mfa_requiredrestriction in the gemspecNEWS.mdversion.rbis bumped without a corresponding section inNEWS.mdWhat a reviewer should know
One-time setup required on RubyGems.org: a gem owner needs to configure a trusted publisher for this repo under the
factory_botgem settings (GitHub →thoughtbot/factory_bot, workflowrelease.yml).Changelog extraction: the
awkscript pulls the bullet points between the matching version header and the next##header inNEWS.md. The## Unreleasedentries should be moved under the new version header before bumpingversion.rb. A newvalidate-changelogworkflow enforces this on PRs.