Publish RubyGem #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |