Skip to content

Publish

Publish #1

Workflow file for this run

name: Publish
on:
workflow_call:
inputs:
new-gem-version:
default: false
type: boolean
workflow_dispatch:
inputs:
new-gem-version:
description: 'Force publish gem?'
default: false
type: boolean
concurrency: rubygems
jobs:
deploy:
name: Publish Ruby Gem
environment: rubygems
permissions:
contents: write # needed to be able to tag the release
runs-on: ubuntu-latest
if: inputs.new-gem-version
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
show-progress: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: '3'
bundler-cache: true
- name: Publish
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem
cat << EOF > ~/.gem/credentials
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
# tag will be associated with github-actions bot user, see
# https://github.community/t/github-actions-bot-email-address/17204
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
bundle exec rake release