Publish Gem #13
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 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' |