ryancyq/rodiff

View on GitHub
.github/workflows/release.yml

Summary

Maintainability
Test Coverage
name: Release Version
run-name: Release Version ${{ inputs.version }}
concurrency:
  group: release-new-version
  cancel-in-progress: true
on:
  workflow_dispatch:
    inputs:
      version:
        description: Gem Version
        required: true
        type: string

env:
  GEM_VERSION: ${{ inputs.version }}

jobs:
  rubygems:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      id-token: write
    environment: release
    timeout-minutes: 3

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Ruby and gems
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
          bundler: latest

      - name: Bump version ${{ env.GEM_VERSION }}
        run: bin/bump-version ${{ env.GEM_VERSION }}
        shell: bash

      - name: Commit Gemfile.lock & lib/rodiff/version.rb
        uses: ryancyq/github-signed-commit@v1
        env:
          GH_TOKEN: ${{ github.token }}
        with:
          files: |
            Gemfile.lock
            lib/rodiff/version.rb
          commit-message: Bump version for ${{ env.GEM_VERSION }}
          tag: v${{ env.GEM_VERSION }}

      - name: Package gems
        run: |
          bundle exec rake package
        shell: bash

      - name: Configure RubyGems trusted publishing credentials
        uses: rubygems/configure-rubygems-credentials@v1.0.0

      - name: Push gems
        run: |
          for gem in pkg/rodiff-$GEM_VERSION*.gem ; do
            gem push "$gem" --host https://rubygems.org
          done
        shell: bash