Maintainer-only. This file is deliberately excluded from the packaged gem.
Releases are one workflow_dispatch. There is no rake release, no manual
gem push, and no local credential. Everything below either happens in CI or has to
be committed to master before you dispatch.
.github/workflows/release.yml, dispatched from
Actions → Release
with a single version input (e.g. 2.0.0, or 2.1.0.beta1):
- Verify version — reads
Capybara::Screenshot::Diff::VERSIONout oflib/and fails if it does not equal the input. This is the guard that makes the dispatch safe: the version lives inlib/snap_diff/version.rband must already be onmaster. - Test —
bundle exec rake test:uniton Ruby 4.0. - Tag — creates and pushes
v<version>. Idempotent: it skips if the tag already exists at HEAD and fails loudly if it exists at a different commit. A failed run can be re-dispatched without cleanup. - Publish
capybara-screenshot-diff—rubygems/release-gem@v1, via RubyGems trusted publishing (OIDC). No API key is stored anywhere. - Publish the
snap_diff-capybaramirror — the same gemspec is loaded, renamed in memory, built and pushed. The mirror gemspec is generated in CI, never committed, so localgem buildand thegemspecdirective ingems.rbstay unambiguous. It reuses the credentialrelease-gemalready set up, which covers any gem whose rubygems.org settings trust this repo + workflow. - GitHub Release — body links to the CHANGELOG and upgrade guide at the tag.
Prerelease status is auto-detected from the tag, so
v2.1.0.beta1lands as Pre-release and never displaces the Latest badge.
- Both gem names must trust this repo +
release.ymlas a trusted publisher on rubygems.org —capybara-screenshot-diffandsnap_diff-capybara. If only one does, step 4 or 5 fails after the tag is already pushed; re-dispatch after fixing. - If tag protection rules are ever added to this repo,
v*must allowgithub-actions[bot]to push — that is how step 3 creates the tag.
-
lib/snap_diff/version.rbbumped to the exact version you will type into the workflow. Nothing else holds a version — the gemspec, the legacycapybara/screenshot/diff/version.rband the mirror gemspec all read it. -
CHANGELOG.mdhas a section for this version with a real date (notunreleased), written for someone upgrading from the last stable release rather than from the previous prerelease. - Docs carry no stale version pins —
README.md,docs/UPGRADING.md,docs/snapdiff.md. Grep for the previous version string. - No unfilled placeholders in the section:
grep -n 'PLACEHOLDER' CHANGELOG.md. Each is an HTML comment marking a feature that landed in a parallel lane — fill it from that PR's description, or delete it if the feature did not make this release. - Releasing 2.0.0: swap every install snippet from the
2.0.0.beta4pin to"~> 2.0", and delete the "final is not out yet" clauses next to them. Until 2.0.0 exists on rubygems,gem "capybara-screenshot-diff", "~> 2.0"hard-failsbundle install(Bundler never resolves a prerelease from a plain requirement), so the good pin has to land with the release, not before it. The snippets live inREADME.md,CHANGELOG.md,docs/UPGRADING.md(×2) anddocs/migration-guide.md— re-grep rather than trusting that list:grep -rn 'capybara-screenshot-diff.\{0,4\}2\.0' README.md CHANGELOG.md docs/ -
mise x ruby@4.0.6 -- bundle exec rake test(full suite, both gates) andmise x ruby@4.0.6 -- bundle exec standardrbare green. - CI is green on
masterat the commit you are releasing — the workflow only runstest:unit, which is a subset. -
gem build capybara-screenshot-diff.gemspecand inspect the file list if anything touched the gemspec allow-list.*.gemis gitignored, but delete the artifact anyway — a stale one in the working tree is confusing.
Nothing special to configure. Use a prerelease version string (2.1.0.beta1) in
version.rb and in the dispatch input. RubyGems never resolves a prerelease by
default, and GitHub marks the release Pre-release on its own.
- Both gems visible and at the same version: capybara-screenshot-diff, snap_diff-capybara. A version published under only one name is the failure mode to watch for — the two gems ship identical files and the dual-install guard assumes they never diverge.
- GitHub Release created, with the right Latest/Pre-release status.
-
gem install capybara-screenshot-diff -v <version>in a scratch dir resolves.
Re-dispatch the same version. The tag step is idempotent and gem push rejects a
duplicate version, so the only real hazard is a mirror push that failed for a
credential reason — fix the trusted-publisher settings and re-dispatch. Never
retag: the workflow refuses to move an existing tag and you should not do it by hand
either.