Skip to content
upload-cloud

GitHub Action

Release Gem

v1.1.0 Latest version

Release Gem

upload-cloud

Release Gem

Upload gems to RubyGems.org

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Release Gem

uses: rubygems/[email protected]

Learn more about this action in rubygems/release-gem

Choose a version

Release Gem GitHub Action

This action allows you to automate releasing your gems to RubyGems.org.

Usage

Trusted Publishing

This example jumps right into RubyGems.org's current recommended best practice.

This action supports RubyGems.org's trusted publishing implementation, which allows authenticating to RubyGems.org without manually configuring secrets. To perform trusted publishing with this action, your projects publisher must already be configured on RubyGems.org.

To enter the trusted publishing flow, configure this action's job with the id-token: write permission.

# .github/workflows/push_gem.yml
jobs:
  push:
    name: Push gem to RubyGems.org
    runs-on: ubuntu-latest

    permissions:
      id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
      contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag

    steps:
      # Set up
      - uses: actions/checkout@v4
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: ruby

      # Release
      - uses: rubygems/release-gem@v1

Requirements

For now, this action makes several assumptions about your project:

  1. Your workflow checks out the repository & configures a working Ruby environment
  2. Your project uses bundler to manage dependencies
  3. Your project has the bundler release tasks configured
  4. Your gem has trusted publishing configured on RubyGems.org