diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml index cd29826..d6d1b71 100644 --- a/.github/workflows/gem-push.yml +++ b/.github/workflows/gem-push.yml @@ -3,27 +3,22 @@ name: Ruby Gem on: workflow_dispatch jobs: - build: - name: Build + Publish + push: + name: Push gem to RubyGems.org runs-on: ubuntu-latest + permissions: - contents: read - packages: write + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag steps: - - uses: actions/checkout@v4 - - name: Set up Ruby 3.2 - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.2' + # Set up + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ruby - - name: Publish to RubyGems - run: | - mkdir -p $HOME/.gem - touch $HOME/.gem/credentials - chmod 0600 $HOME/.gem/credentials - printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials - gem build *.gemspec - gem push *.gem - env: - GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}" + # Release + - uses: rubygems/release-gem@v1