Skip to content

Automate gem release workflow #794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build: automate continuous delivery workflow
Use googleapis/release-please-action and rubygems/release-gem actions
to automate releasing and publishing new gem versions to rubygems.
  • Loading branch information
jcouball committed May 15, 2025
commit 3a0464212fc7c03e3fd060e856efc3beffda9690
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Release Gem

description: |
This workflow creates a new release on GitHub and publishes the gem to
RubyGems.org.

The workflow uses the `googleapis/release-please-action` to handle the
release creation process and the `rubygems/release-gem` action to publish
the gem to rubygems.org

on:
push:
branches: ["main"]

workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest

environment:
name: RubyGems
url: https://rubygems.org/gems/git

permissions:
contents: write
pull-requests: write
id-token: write

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Create release
uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.AUTO_RELEASE_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

- name: Setup ruby
uses: ruby/setup-ruby@v1
if: ${{ steps.release.outputs.release_created }}
with:
bundler-cache: true
ruby-version: ruby

- name: Push to RubyGems.org
uses: rubygems/release-gem@v1
if: ${{ steps.release.outputs.release_created }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.0.1"
}
1 change: 0 additions & 1 deletion .yardopts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
README.md
CHANGELOG.md
CONTRIBUTING.md
RELEASING.md
MAINTAINERS.md
85 changes: 0 additions & 85 deletions RELEASING.md

This file was deleted.

7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ task :'test:gem' => :install do

puts 'Gem Test Succeeded'
end

# Make it so that calling `rake release` just calls `rake release:rubygem_push` to
# avoid creating and pushing a new tag.

Rake::Task['release'].clear
desc 'Customized release task to avoid creating a new tag'
task release: 'release:rubygem_push'
36 changes: 36 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"bootstrap-sha": "31374263eafea4e23352494ef4f6bea3ce62c1b5",
"packages": {
".": {
"release-type": "ruby",
"package-name": "git",
"changelog-path": "CHANGELOG.md",
"version-file": "lib/git/version.rb",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"draft": false,
"prerelease": false,
"include-component-in-tag": false,
"pull-request-title-pattern": "chore: release v${version}",
"changelog-sections": [
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "build", "section": "Other Changes", "hidden": false },
{ "type": "chore", "section": "Other Changes", "hidden": false },
{ "type": "ci", "section": "Other Changes", "hidden": false },
{ "type": "docs", "section": "Other Changes", "hidden": false },
{ "type": "perf", "section": "Other Changes", "hidden": false },
{ "type": "refactor", "section": "Other Changes", "hidden": false },
{ "type": "revert", "section": "Other Changes", "hidden": false },
{ "type": "style", "section": "Other Changes", "hidden": false },
{ "type": "test", "section": "Other Changes", "hidden": false }
]
}
},
"plugins": [
{
"type": "sentence-case"
}
],
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}