Skip to content

Publish RubyGem

Publish RubyGem #5

Workflow file for this run

name: Publish RubyGem
on:
release:
types:
- released
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Tests
run: |
bundle exec rspec
- name: Build and publish gem
run: |
echo "Setting up access to GitHub Package Registry"
mkdir -p ~/.gem
touch ~/.gem/credentials
chmod 600 ~/.gem/credentials
echo ":github: Bearer ${GITHUB_TOKEN}" >> ~/.gem/credentials
echo "Building the gem"
find . -name '*.gemspec' -maxdepth 1 -exec gem build {} \;
echo "Pushing the built gem to GitHub Package Registry"
find . -name '*.gem' -maxdepth 1 -print0 | xargs -0 gem push --key github --host "https://rubygems.pkg.github.com/${OWNER}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: the-curve-consulting