From ad4d8b0d48acc201f85ecf34a6a8d5be1f6b1e24 Mon Sep 17 00:00:00 2001 From: Facundo Farias Date: Tue, 29 Sep 2026 12:07:11 +0200 Subject: [PATCH] ci: automate releases with release-please and publish to RubyGems Mirrors the release setup deploy-agent already uses, so this fork releases the same way the rest of our gems do rather than inventing a second pattern. release-please maintains a release PR that bumps lib/procodile/version.rb and writes CHANGELOG.md from Conventional Commit messages; merging that PR is what cuts a release and triggers the publish. Publishing reuses the existing org-level RUBYGEMS_API_KEY secret, which has visibility "all", so this repository already has access to it -- no new secret needs provisioning. The release job runs the suite before pushing. The workflow fires on master after the release PR is merged, so nothing has otherwise exercised the merge result, and a published version number can be yanked but never reused. Also drops the committed Gemfile.lock and gitignores it: - It pins rspec-core 3.5.4 from 2016, which does not install on any current Ruby. `bundle install` failed against it, which is why the CI workflow installs rspec directly instead of using bundler. - Gems conventionally do not commit a lockfile, and deploy-agent gitignores its own for the same reason. With it gone, `bundle install && bundle exec rspec -Ilib` works, which is what lets the release job use bundler-cache like deploy-agent does. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + .release-please-manifest.json | 3 ++ Gemfile.lock | 37 ------------------------- release-please-config.json | 27 ++++++++++++++++++ 5 files changed, 83 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .release-please-manifest.json delete mode 100644 Gemfile.lock create mode 100644 release-please-config.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9a79676 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + # Maintains a release PR that bumps lib/procodile/version.rb and the CHANGELOG + # from Conventional Commit messages. Merging that PR is what cuts a release. + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release-please.outputs.release_created }} + version: ${{ steps.release-please.outputs.version }} + steps: + - uses: googleapis/release-please-action@v4 + id: release-please + + release: + runs-on: ubuntu-latest + needs: [release-please] + if: ${{ needs.release-please.outputs.release_created }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.4' + bundler-cache: true + + # The release workflow runs on master, after the release PR is merged, so + # nothing has re-run the suite against the merge result. Publishing is + # irreversible -- a pushed version number can be yanked but never reused -- + # so gate the push on a green suite rather than assuming. + - name: Run tests + run: bundle exec rspec -Ilib + + - name: Build gem + run: gem build *.gemspec + + - name: Setup credentials + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials + env: + RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + + - name: Publish to RubyGems + run: gem push *.gem diff --git a/.gitignore b/.gitignore index fc29803..c03bbba 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ test-app/pids test-app/procodile.log global.yml *.gem +Gemfile.lock diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..76f5c64 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.27" +} diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index dcf60de..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,37 +0,0 @@ -PATH - remote: . - specs: - procodile (1.0.27) - json - -GEM - remote: https://rubygems.org/ - specs: - diff-lcs (1.3) - json (2.2.0) - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - -PLATFORMS - ruby - -DEPENDENCIES - procodile! - rspec - rspec-core - rspec-expectations - rspec-mocks - -BUNDLED WITH - 1.17.3 diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..17f1958 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,27 @@ +{ + "pull-request-header": ":robot: I have created a release", + "packages": { + ".": { + "release-type": "ruby", + "version-file": "lib/procodile/version.rb", + "changelog-path": "CHANGELOG.md", + "draft": false, + "prerelease": false + } + }, + "changelog-sections": [ + { "type": "feat", "section": "Features" }, + { "type": "feature", "section": "Features" }, + { "type": "fix", "section": "Bug Fixes" }, + { "type": "perf", "section": "Performance Improvements" }, + { "type": "revert", "section": "Reverts" }, + { "type": "docs", "section": "Documentation" }, + { "type": "style", "section": "Styles" }, + { "type": "chore", "section": "Miscellaneous Chores" }, + { "type": "refactor", "section": "Code Refactoring" }, + { "type": "test", "section": "Tests", "hidden": true }, + { "type": "build", "section": "Build System", "hidden": true }, + { "type": "ci", "section": "Continuous Integration", "hidden": true } + ], + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}