From 7970697fdebd44f9c72b13062883a21456ee57f5 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 24 Dec 2024 16:28:48 +0900 Subject: [PATCH] release: Add support for Trusted Publishing --- .github/workflows/release.yml | 18 ++++++++++++++++++ Rakefile | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3923f9d..a0fe2d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,3 +43,21 @@ jobs: --title "${title}" env: GH_TOKEN: ${{ github.token }} + + rubygems: + name: RubyGems + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + id-token: write + environment: release + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ruby + bundler-cache: true + - uses: rubygems/configure-rubygems-credentials@v1.0.0 + - name: Push gems + run: | + bundle exec rake release:rubygem_push diff --git a/Rakefile b/Rakefile index ae4468c..bf39bd5 100644 --- a/Rakefile +++ b/Rakefile @@ -44,3 +44,13 @@ desc "Run tests" task :test do ruby("test/run-test.rb") end + +release_task = Rake.application["release"] +# We use Trusting Publishing +release_task.prerequisites.delete("build") +release_task.prerequisites.delete("release:rubygem_push") +release_task_comment = release_task.comment +if release_task_comment + release_task.clear_comments + release_task.comment = release_task_comment.gsub(/ and build.*$/, "") +end