Skip to content

Commit

Permalink
Add support for Trusted Publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 10, 2025
1 parent 841303a commit 5b8546d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2024 Sutou Kouhei <kou@clear-code.com>
# Copyright (C) 2024-2025 Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -39,3 +39,20 @@ 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
14 changes: 12 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- mode: ruby; coding: utf-8 -*-
# -*- ruby -*-
#
# Copyright (C) 2013 Kouhei Sutou <kou@clear-code.com>
# Copyright (C) 2013-2025 Sutou Kouhei <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -46,3 +46,13 @@ desc "Run tests"
task :test do
ruby("test/run-test.rb")
end

release_task = Rake.application["release"]
# We use Trusted 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

0 comments on commit 5b8546d

Please sign in to comment.