Skip to content

Commit 368465e

Browse files
authored
Merge pull request rails#54513 from segiddins/segiddins/release-gems-with-attestations-from-github-actions
Release gems with attestations from GitHub Actions
2 parents 1037508 + c771555 commit 368465e

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

Gemfile.lock

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ PATH
113113
releaser (1.0.0)
114114
minitest
115115
rake (~> 13.0)
116+
sigstore-cli
116117

117118
GEM
118119
remote: https://rubygems.org/
@@ -397,6 +398,8 @@ GEM
397398
ruby2_keywords (~> 0.0.1)
398399
mutex_m (0.3.0)
399400
mysql2 (0.5.6)
401+
net-http (0.6.0)
402+
uri
400403
net-http-persistent (4.0.5)
401404
connection_pool (~> 2.2)
402405
net-imap (0.5.5)
@@ -433,6 +436,16 @@ GEM
433436
actionpack (>= 7.0.0)
434437
activesupport (>= 7.0.0)
435438
rack
439+
protobug (0.1.0)
440+
protobug_googleapis_field_behavior_protos (0.1.0)
441+
protobug (= 0.1.0)
442+
protobug_well_known_protos (= 0.1.0)
443+
protobug_sigstore_protos (0.1.0)
444+
protobug (= 0.1.0)
445+
protobug_googleapis_field_behavior_protos (= 0.1.0)
446+
protobug_well_known_protos (= 0.1.0)
447+
protobug_well_known_protos (0.1.0)
448+
protobug (= 0.1.0)
436449
psych (5.2.6)
437450
date
438451
stringio
@@ -586,6 +599,13 @@ GEM
586599
faraday (>= 0.17.5, < 3.a)
587600
jwt (>= 1.5, < 3.0)
588601
multi_json (~> 1.10)
602+
sigstore (0.2.1)
603+
net-http
604+
protobug_sigstore_protos (~> 0.1.0)
605+
uri
606+
sigstore-cli (0.2.1)
607+
sigstore (= 0.2.1)
608+
thor
589609
sinatra (4.1.1)
590610
logger (>= 1.6.0)
591611
mustermann (~> 3.0)

tools/releaser/Gemfile.lock

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,34 @@ PATH
44
releaser (1.0.0)
55
minitest
66
rake (~> 13.0)
7+
sigstore-cli
78

89
GEM
910
remote: https://rubygems.org/
1011
specs:
1112
minitest (5.25.1)
13+
net-http (0.6.0)
14+
uri
15+
protobug (0.1.0)
16+
protobug_googleapis_field_behavior_protos (0.1.0)
17+
protobug (= 0.1.0)
18+
protobug_well_known_protos (= 0.1.0)
19+
protobug_sigstore_protos (0.1.0)
20+
protobug (= 0.1.0)
21+
protobug_googleapis_field_behavior_protos (= 0.1.0)
22+
protobug_well_known_protos (= 0.1.0)
23+
protobug_well_known_protos (0.1.0)
24+
protobug (= 0.1.0)
1225
rake (13.2.1)
26+
sigstore (0.2.1)
27+
net-http
28+
protobug_sigstore_protos (~> 0.1.0)
29+
uri
30+
sigstore-cli (0.2.1)
31+
sigstore (= 0.2.1)
32+
thor
33+
thor (1.3.2)
34+
uri (1.0.2)
1335

1436
PLATFORMS
1537
aarch64-linux
@@ -19,4 +41,4 @@ DEPENDENCIES
1941
releaser!
2042

2143
BUNDLED WITH
22-
2.5.17
44+
2.6.3

tools/releaser/lib/releaser.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def define
6767

6868
task push: :build do
6969
Dir.chdir(root) do
70-
sh "gem push #{gem_path(framework)}#{gem_otp}"
70+
sh "gem push #{gem_path(framework)}#{gem_otp(gem_path(framework))}"
7171

7272
if File.exist?("#{framework}/package.json")
7373
Dir.chdir("#{framework}") do
@@ -314,10 +314,11 @@ def npm_otp
314314
" --provenance --access public"
315315
end
316316

317-
def gem_otp
317+
def gem_otp(gem_path)
318318
" --otp " + ykman("rubygems.org")
319319
rescue
320-
""
320+
sh "sigstore-cli sign #{gem_path} --bundle #{gem_path}.sigstore.json"
321+
" --attestation #{gem_path}.sigstore.json"
321322
end
322323

323324
def ykman(service)

tools/releaser/releaser.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
2323

2424
s.add_dependency "rake", "~> 13.0"
2525
s.add_dependency "minitest"
26+
s.add_dependency "sigstore-cli"
2627
end

0 commit comments

Comments
 (0)