Skip to content

Publish Gem

Publish Gem #1

Workflow file for this run

name: Publish Gem
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Install dependencies 📦
run: |
echo 'gem: --no-document' >> ~/.gemrc
gem install bundler
bundle install
- name: Build Gem 📦
run: gem build *.gemspec
- name: Publish Gem 🚀
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}" > $HOME/.gem/credentials
gem push *.gem
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}