From 324bc78128e4accfd95fb13d86188e957e202c5f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 21 Nov 2024 18:59:33 +0100 Subject: [PATCH] Fix release action --- .github/workflows/release.yaml | 40 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2559a2d..fe537e5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,24 +1,32 @@ -name: Publish Gem +name: Release on: - workflow_dispatch: + push: + tags: + - '*' + jobs: - build: + release: runs-on: ubuntu-latest - permissions: - contents: write - + if: github.repository_owner == 'voxpupuli' steps: - uses: actions/checkout@v4 - - uses: fregante/setup-git-user@v2 - - uses: ruby/setup-ruby@v1 + - name: Install Ruby 3.3 + uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2.3 - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - name: Release Gem - uses: cadwallion/publish-rubygems-action@master + ruby-version: '3.3' + env: + BUNDLE_WITHOUT: release:development:rubocop + - name: Build gem + run: gem build --verbose *.gemspec + - name: Publish gem to rubygems.org + run: gem push *.gem env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} - RELEASE_COMMAND: bundle exec rake release \ No newline at end of file + GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}' + - name: Setup GitHub packages access + run: | + mkdir -p ~/.gem + echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials + chmod 0600 ~/.gem/credentials + - name: Publish gem to GitHub packages + run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem