Skip to content

Add gem release workflow with GitHub release notes from changelog#1815

Open
neilvcarvalho wants to merge 3 commits intomainfrom
claude/determined-dijkstra-f9a6d2
Open

Add gem release workflow with GitHub release notes from changelog#1815
neilvcarvalho wants to merge 3 commits intomainfrom
claude/determined-dijkstra-f9a6d2

Conversation

@neilvcarvalho
Copy link
Copy Markdown
Member

@neilvcarvalho neilvcarvalho commented Apr 17, 2026

Summary

  • Adds a GitHub Actions workflow that triggers when lib/factory_bot/version.rb changes on main and publishes the gem to RubyGems.org
  • Uses RubyGems trusted publishing (OIDC) so no API key needs to be stored as a secret — compatible with the rubygems_mfa_required restriction in the gemspec
  • After the gem is pushed, creates a GitHub Release populated with the relevant section extracted from NEWS.md
  • Adds a PR check that fails if version.rb is bumped without a corresponding section in NEWS.md

What 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_bot gem settings (GitHub → thoughtbot/factory_bot, workflow release.yml).

  • Changelog extraction: the awk script pulls the bullet points between the matching version header and the next ## header in NEWS.md. The ## Unreleased entries should be moved under the new version header before bumping version.rb. A new validate-changelog workflow enforces this on PRs.

neilvcarvalho and others added 2 commits April 17, 2026 16:40
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@neilvcarvalho neilvcarvalho force-pushed the claude/determined-dijkstra-f9a6d2 branch from 5d54c5d to 17509cf Compare April 17, 2026 19:57
@neilvcarvalho neilvcarvalho marked this pull request as ready for review April 17, 2026 19:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.rb is updated without a matching NEWS.md section.
  • 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"
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.

2 participants