Skip to content

ActionsToolbox/gem-build-and-release-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ActionsToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This action works by executing the following commands:

  • bundle install
  • gem build --output=latest-release.gem
  • gem push latest-release.gem

Assuming PUBLISH is set to true which is the default.

We create and publish the gems this way for a few very specific reasons:

  • We want to minimise the permissions that need to be given to the action.
  • We do not want the action to make any changes to the existing repository.
  • We want the action to only execute the minimum steps required to build and publish a gem.

There are many other gems available that work with rake release if this is your preferred method. The 2 that we recommend are below:

Our action is closely based on publish rubygems action.

Publish

name: Publish Gem

on:
  push:
    tags:
      - 'v[0-9].[0-9]+.[0-9]+'
      - '!v[0-9].[0-9]+.[0-9]+rc[0-9]+'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Release Gem
        uses: ActionsToolbox/gem-build-and-release-action@master
        env:
          RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}

Build but Don't Publish

name: Test Publish Gem

on:
  push:
    tags:
      - 'v[0-9].[0-9]+.[0-9]+rc[0-9]+'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Release Gem
        uses: ActionsToolbox/gem-build-and-release-action@master
        env:
          RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
          PUBLISH: false