Skip to content

Publish releases to GitHub Packages automatically on version bump - #76

Open
Jason Wells (jasonwells) wants to merge 7 commits into
masterfrom
claude/gallant-thompson-3f55ht
Open

Jason Wells (jasonwells) wants to merge 7 commits into
masterfrom
claude/gallant-thompson-3f55ht

Conversation

@jasonwells

@jasonwells Jason Wells (jasonwells) commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves gem releases from rubygems.org (manual tag push, broken since v1.0.0) to the patterninc GitHub Packages RubyGems registry, fully automatic, backfills the versions apps already pin, and moves CI to Ruby 3.3/3.4 with a Rails 8.0/8.1 matrix.

  • New workflow .github/workflows/publish_github_packages.yml replaces publish_rubygems.yml. When a merge to master changes lib/query_helper/version.rb (or on manual workflow_dispatch, master only), it runs the specs, builds the gem, pushes to https://rubygems.pkg.github.com/patterninc, then tags vX.Y.Z and creates a GitHub release with the CHANGELOG section as notes. A version that already has a tag is not re-published, and a missing release is created on re-run. Uses the built-in GITHUB_TOKEN (contents: write, packages: write); no RUBYGEMS_API_KEY.
  • Backfill workflow .github/workflows/backfill_github_packages.yml (manual, master only) publishes already-released tags (default: v0.3.2 v0.3.5 v0.3.6 v0.3.8 v0.4.1 v0.4.3 v0.4.4, the tags the patterninc apps pin) under each tag's own version number.
  • CI matrix: Ruby 3.3 and 3.4 x Rails 8.0 and 8.1. ci.yml runs the 66-example RSpec suite in four jobs. Rails 8.0 uses the root Gemfile; Rails 8.1 uses gemfiles/rails_8_1.gemfile (with its own lockfile). A final job named test depends on the matrix, so a required check called test keeps working. Previously ubuntu-latest (now 26.04) had no Ruby 2.7.2 build, so ci.yml and brakeman.yml were already failing on this branch, and 2.7 is end-of-life. Every app that uses the gem is on Ruby 3.3+ and Rails 8.x.
  • Dev-only changes: gemspec dev dependencies actionpack and activesupport are >= 8; the root Gemfile holds the lockfile at Rails 8.0 (~> 8.0.0); faker is >= 2.0 (1.9.x crashes on Ruby 3.2+, specs updated to its keyword API); the bundler dev dependency is loosened; Gemfile.lock is regenerated (Bundler 2.5.22). No change to lib/. The runtime requirements (activerecord > 5, Ruby >= 2.6.0) are unchanged, but CI no longer exercises Rails older than 8.
  • Gemspec: allowed_push_host is set to the GitHub Packages registry so nothing is pushed to rubygems.org by accident.
  • Docs: README install, development and release steps, AGENTS.md, the release-gem skill, CHANGELOG (Unreleased) and ADR 0003.
  • The version number stays a human decision in version.rb. This PR does not bump it, so merging it publishes nothing by itself.

Things to know before merging

  • Package access is managed on the package, not the repo. New RubyGems packages on GitHub Packages are private by default regardless of repo visibility. After the first publish, an org admin should check Package settings (link the repo, give patterninc members read access) and must never make it public (irreversible).
  • Consumers need a token with read:packages. Other repos' Actions need the package's Manage Actions access (read) and permissions: packages: read, or a token secret.
  • If the registry push succeeds but the tag step fails, a re-run fails on the duplicate version; push the tag by hand.
  • Verified locally on Ruby 3.3.6: bundle exec rspec spec on Rails 8.0.5 and on Rails 8.1.4 (66 examples, 0 failures each) and Brakeman 5.4.1 (no warnings). Ruby 3.4 could not be installed in my environment, so its CI jobs are the first run. The publish and backfill workflows have not been run; the first real release is their test.
  • The v1.0.0 publish never reached rubygems.org, which still lists 0.4.0.

Test plan

  • CI green on all four matrix jobs and Brakeman
  • After merge, run "Backfill Gem Versions" and confirm the seven versions appear under the repo's Packages; review the package's access settings
  • Later, merge a version bump and confirm the version is published, tagged and released
  • Install from a clean machine using the README steps

🤖 Generated with Claude Code

https://claude.ai/code/session_012qnLKR2P3W8yV9WHhmSnJA

Adds the proposed publish workflow (agents can't write .github/workflows),
restricts allowed_push_host to the patterninc GitHub Packages registry,
and updates README, AGENTS.md, the release skill, CHANGELOG and ADR 0003.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qnLKR2P3W8yV9WHhmSnJA
Copilot AI balanced review requested due to automatic review settings November 13, 2026 00:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The publish workflow uses a Ruby version unavailable on the current ubuntu-latest runner, causing it to fail before testing or publishing.

5 open issues
What changed in this PR

Moves query_helper gem publishing from rubygems.org to GitHub Packages, with releases triggered automatically by version changes merged to master. This PR does not bump the gem version.

Changes:

  • Replaces tag-triggered publishing with a workflow that tests, builds, publishes, tags, and creates a GitHub release.
  • Restricts the gem’s push destination to the patterninc GitHub Packages registry.
  • Updates installation instructions, release guidance, and architecture documentation.
File Description
README.md Documents authenticated installation and automatic releases.
query_helper.gemspec Restricts the allowed registry for publishing.
docs/​adr/​README.md Adds the release architecture decision to the index.
docs/​adr/​0003-publish-to-github-packages.md Records the registry migration and operational considerations.
CHANGELOG.md Adds migration details and consumer upgrade notes.
AGENTS.md Updates registry and release-process guidance.
.github/​workflows/​publish_rubygems.yml Removes the previous tag-triggered publisher.
.github/​workflows/​publish_github_packages.yml Adds automated package and GitHub release publishing.
.agents/​skills/​release-gem/​SKILL.md Aligns release preparation with publishing on merge.

Review effort: Balanced

Comment thread README.md Resolved
…eparate tag/release re-runs, correct package access docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qnLKR2P3W8yV9WHhmSnJA
Ruby 2.7 is end-of-life and unavailable on current runners; every app
that uses the gem is on Ruby 3.3+. Bump faker (>= 2.0) and loosen the
bundler dev dependency, regenerate Gemfile.lock (Rails 8.1, Bundler 2.5.22),
and update the docs. No change to lib/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qnLKR2P3W8yV9WHhmSnJA
@wiz-55ccc8b716

wiz-55ccc8b716 Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings 2 High
Total 2 High

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Comment thread Gemfile.lock
concurrent-ruby (1.3.8)
connection_pool (3.0.2)
crass (1.0.8)
diff-lcs (1.6.2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

High Software Management Finding - Software License

Code library with Restrictive license

More Details

Code library diff-lcs version 1.6.2 has GPL-2.0-or-later license, categorized as Restrictive, its use may cause a supply chain licensing issue.

Remediation guidance

  • Review the license terms to understand its specific rules.
  • If needed, replace this component immediately with an alternative using a permissive license (e.g., MIT, Apache 2.0).
  • Consult your legal team if the component is business-critical or the terms are unclear.

To ignore this finding as an exception, reply to this conversation with #wiz_ignore reason

If you'd like to ignore this finding in all future scans, add an exception in the .wiz file (learn more) or create an Ignore Rule (learn more).


To get more details on how to remediate this issue using AI, reply to this conversation with #wiz remediate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Traced, not accepted yet. diff-lcs is a transitive development dependency of RSpec (rspec-expectations), used only to print spec failure diffs. It is not a dependency of the published gem: the gemspec's only runtime dependencies are activerecord and activesupport, so it doesn't ship to consumers. It was already in the lockfile on master (1.4.4); this PR only moved it to 1.6.2 when the lockfile was regenerated. It can't be removed without dropping RSpec. Leaving this thread open for a maintainer to decide whether to record a license exception for a dev-only dependency.


Generated by Claude Code

Comment thread Gemfile.lock
logger
prism (>= 1.6.0)
tsort
rdoc (8.1.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

High Software Management Finding - Software License

Code library with Restrictive license

More Details

Code library rdoc version 8.1.0 has GPL-2.0-only license, categorized as Restrictive, its use may cause a supply chain licensing issue.

Remediation guidance

  • Review the license terms to understand its specific rules.
  • If needed, replace this component immediately with an alternative using a permissive license (e.g., MIT, Apache 2.0).
  • Consult your legal team if the component is business-critical or the terms are unclear.

To ignore this finding as an exception, reply to this conversation with #wiz_ignore reason

If you'd like to ignore this finding in all future scans, add an exception in the .wiz file (learn more) or create an Ignore Rule (learn more).


To get more details on how to remediate this issue using AI, reply to this conversation with #wiz remediate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Traced, not accepted yet. rdoc is new in the lockfile: it is required by irb, which comes in through the Rails development and test dependencies (railties, via the Rails 8 dev setup). It is not a dependency of the published gem: the gemspec's only runtime dependencies are activerecord and activesupport, so it doesn't ship to consumers. It can't be removed without dropping Rails' test tooling. Leaving this thread open for a maintainer to decide whether to record a license exception for a dev-only dependency.


Generated by Claude Code

Adds gemfiles/rails_8_1.gemfile (+ lockfile) and a 2x2 matrix. A final
'test' job keeps the existing required-check name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qnLKR2P3W8yV9WHhmSnJA
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.

3 participants