Skip to content

Publish Gem

Publish Gem #2

Workflow file for this run

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish (e.g. v0.6.5)"
required: true
type: string
name: Publish Gem
permissions:
contents: read
id-token: write
jobs:
gem-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: ruby/setup-ruby@e65c17d16e57e481586a6a5a0282698790062f92 # v1.300.0
- run: bundle install
- name: Build Gem
run: |
mapfile -t gemspecs < <(find . -maxdepth 1 -type f -name '*.gemspec' -printf '%f\n' | sort)
if [ "${#gemspecs[@]}" -ne 1 ]; then
echo "Expected exactly one gemspec in the repository root, found ${#gemspecs[@]}: ${gemspecs[*]}" >&2
exit 1
fi
gem build "${gemspecs[0]}"
- name: Push Gem
uses: rubygems/release-gem@6317d8d1f7e28c24d28f6eff169ea854948bd9f7 # v1.2.0