diff --git a/.github/workflows/gem-release.yml b/.github/workflows/gem-release.yml index 921bf27..038be7b 100644 --- a/.github/workflows/gem-release.yml +++ b/.github/workflows/gem-release.yml @@ -5,48 +5,24 @@ on: branches: [ "main" ] types: - closed - jobs: if_merged: if: github.event.pull_request.merged == true runs-on: ubuntu-latest - name: Build + Publish with Ruby ${{ matrix.ruby }} - strategy: - matrix: - ruby: - - '3.2.2' + permissions: - contents: read - packages: write - steps: - - run: | - echo The PR was merged - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true + contents: write + id-token: write - - name: Publish to GPR - run: | - mkdir -p $HOME/.gem - touch $HOME/.gem/credentials - chmod 0600 $HOME/.gem/credentials - printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials - gem build *.gemspec - gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem - env: - GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}" - OWNER: ${{ github.repository_owner }} + environment: release + + steps: + - 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}}" \ No newline at end of file + # Release + - uses: rubygems/release-gem@v1 \ No newline at end of file