Skip to content

ci: publish to RubyGems with Trusted Publishing from master - #232

Merged
mogita merged 2 commits into
masterfrom
ci/rubygems-trusted-publishing
Nov 18, 2026
Merged

mogita merged 2 commits into
masterfrom
ci/rubygems-trusted-publishing

Conversation

@mogita

@mogita mogita commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Submit a pull request

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

The release job pushes the gem with the long-lived RUBYGEMS_API_KEY secret, which may have been exposed in the GitHub Actions secret incident. This switches the push to RubyGems Trusted Publishing: the publish job exchanges its OIDC token for a short-lived RubyGems API key, so the repo no longer needs a RubyGems secret.

  • The release runs on push to master instead of on the closed release PR. A check job releases while the VERSION from lib/stream-chat/version.rb was never pushed to RubyGems, which is the case right after a release PR is squash-merged. A published or yanked version skips the release, and any other RubyGems answer fails the run. The release is always the commit that set VERSION, so a rerun or a later push publishes the reviewed release PR and nothing merged after it. An existing tag for the version must point at that commit, or the run fails. Release runs are serialized, so overlapping pushes cannot build the same version twice.
  • build runs checkout, the changelog script and gem build with contents: read and uploads the gem.
  • release creates the tag and GitHub release on the released commit with contents: write, before the push, and keeps them on a rerun.
  • publish is the only job with id-token: write. It downloads the gem and runs rubygems/configure-rubygems-credentials and gem push, in the rubygems environment. That environment allows master only, and the RubyGems trusted publisher for stream-chat-ruby requires it, so a branch with an edited release.yml cannot publish. Every action in the workflow is pinned to a commit.

The release process in CONTRIBUTING.md is unchanged: run initiate_release, then squash-merge the release PR.

How to verify: the merge of this PR runs check with release=false (3.27.1 is on RubyGems) and skips the rest. The next release PR merge publishes to RubyGems without RUBYGEMS_API_KEY. After that, the RUBYGEMS_API_KEY secret is removed.

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/release.yml Resolved
@mogita
mogita merged commit a67a72a into master Nov 18, 2026
10 checks passed
@mogita
mogita deleted the ci/rubygems-trusted-publishing branch November 18, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant