ci(deploy): rake release[X.Y.Z] + OIDC trusted-publishing release workflow - #42
Merged
Conversation
…kflow
Sets up releases the same way as the sibling gems (daisyui, phlex-reactive,
pgbus), ahead of the v1 cut.
## Summary
- Rakefile: a `rake release[X.Y.Z]` task (main-only, clean-tree guarded) that
bumps lib/docs_kit/version.rb, updates Gemfile.lock + docs/Gemfile.lock,
verifies `gem build --strict`, commits, pushes, and creates the GitHub
Release. Supports `pre` (pre-release) and `force` (re-cut a tag). Plus a
`rake build` gem content-verify task. Drops `bundler/gem_tasks` (its own
arg-less `release` task would collide); spec/rubocop/default stay explicit.
- .github/workflows/release.yml: on `release: published`, test (3.2/3.3/3.4) →
build + content-check → publish-rubygems → upload-release-assets. Publishes
over OIDC trusted publishing (rubygems/configure-rubygems-credentials, SHA
pinned), Sigstore-signs the gem, and is idempotent (skips a re-push of an
already-published version). `rubygems` environment + id-token: write.
- README "Releasing (maintainers)": the task usage + the ONE-TIME setup
(RubyGems pending trusted publisher + the `rubygems` GitHub environment)
without which the first release fails.
- .rubocop.yml: exclude Rakefile from Metrics/BlockLength (the release task is
a long sequential script by design, matching the sibling gems).
- CHANGELOG: Unreleased entry.
## Verification
- [x] rake -T lists release[version,force] + build
- [x] rake build packs cleanly (--strict); gem contents pass the workflow's
unwanted-files guard (no .gemspec/.git*/spec dirs; 79 files)
- [x] release.yml is valid YAML; 4 jobs; environment: rubygems; id-token: write
- [x] bundle exec rubocop — clean (103 files)
- [x] bundle exec rspec — 505 examples, 0 failures
Refs #8
Claude-Session: https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX
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.
What & why
docs-kit is ready for a v1.0.0 cut. This wires up releases the exact same way as the sibling gems — daisyui, phlex-reactive, and pgbus — so the whole family releases identically: a version-bumping
rake release[X.Y.Z]task plus an OIDC trusted-publishing GitHub Actions workflow.Refs #8.
Changes
rake release[X.Y.Z](Rakefile) — ported from the sibling gems, adapted for docs-kit:mainwith a clean working tree.lib/docs_kit/version.rb, updatesGemfile.lockanddocs/Gemfile.lock(the dogfood site), verifiesgem build --strict, commits, pushes, and creates the GitHub Release with generated notes.rake release[X.Y.Z,force]deletes + re-cuts an existing tag/release;rake release[pre]flags a pre-release.rake buildgem content-verify task.require "bundler/gem_tasks"(its arglessreleasetask collides with the parameterized one);spec/rubocop/defaultremain explicit..github/workflows/release.yml— fires onrelease: published, mirroring daisyui's hardened variant:testbundle exec rakeon Ruby 3.2 / 3.3 / 3.4build--strict, content-checks the gem (no.gemspec/.git*/spec dirs), generates SHA256/512publish-rubygemsrubygems/configure-rubygems-credentials(SHA-pinned), Sigstore-signs,gem push --attestation; idempotent (skips if the version is already on RubyGems)upload-release-assetsNo API token is stored anywhere —
id-token: write+ therubygemsenvironment do it over OIDC.Docs: a README "Releasing (maintainers)" section with the task usage and the one-time setup (RubyGems pending trusted publisher + the GitHub
rubygemsenvironment) — without which the first release fails. CHANGELOG Unreleased entry..rubocop.ymlexcludes the Rakefile fromMetrics/BlockLength(the release task is a long sequential script by design, same as the sibling gems).Trusted publishing requires two things wired once (documented in the README):
docs-kit, repomhenrixon/docs-kit, workflowrelease.yml, environmentrubygems). "Pending" works for a gem not yet pushed, so0.1.0never needs a manualgem push— the very firstrake release[1.0.0]publishes over OIDC.rubygemsenvironment — Settings → Environments → new environment namedrubygems.Verification
rake -Tlistsrelease[version,force]+build.rake buildpacks cleanly (--strict); the gem passes the workflow's unwanted-files guard (no.gemspec/.git*/spec dirs; 79 files).release.ymlis valid YAML — 4 jobs,environment: rubygems,id-token: write, triggerrelease: published.bundle exec rubocop— clean (103 files).bundle exec rspec— 505 examples, 0 failures (droppingbundler/gem_tasksbroke nothing).Test plan
The workflow can't be dry-run without an actual release. After merge + the one-time setup above,
rake release[1.0.0]cuts v1 and the workflow publishes it.rake release[1.0.0,force]is the recovery path if anything needs re-cutting.https://claude.ai/code/session_01FPQb6z3YwcKRMbvoJhdxnX