Skip to content

Publish Gem

Publish Gem #13

Workflow file for this run

name: Publish Gem
on:
workflow_run:
workflows: ["Ruby CI"]
types:
- completed
jobs:
build:
name: Build + Publish
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: bundle install
- name: Publish to RubyGems
run: |
bundle exec rake version["${{ github.ref_name }}"]
bundle exec gem build --strict
gem push "rspec-sonarqube-formatter-${{ github.ref_name }}.gem"
# Update version to next beta version
NEXT_PATCH_TAG=$(echo "${{ github.ref_name }}" | awk 'BEGIN{FS=OFS="."} {$3+=1} 1')
BETA_TAG="${NEXT_PATCH_TAG}.pre"
bundle exec rake version["${BETA_TAG}"]
bundle install
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update version
file_pattern: '*.gemspec Gemfile.lock'