Skip to content

Commit 5a217ca

Browse files
committed
Only ask for signing password, if key is encrypted
This avoids password query in CI.
1 parent dd8360e commit 5a217ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Rakefile.cross

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,12 @@ task 'gem:windows:prepare' do
282282
mkdir_p 'build/gem'
283283
sh "cp ~/.gem/gem-*.pem build/gem/ || true"
284284
sh "bundle package"
285-
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
285+
begin
286+
OpenSSL::PKey.read(File.read(File.expand_path("~/.gem/gem-private_key.pem")), ENV["GEM_PRIVATE_KEY_PASSPHRASE"] || "")
287+
rescue OpenSSL::PKey::PKeyError
288+
ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
289+
retry
290+
end
286291
end
287292

288293
%w[ x86-mingw32 x64-mingw32 ].each do |platform|

0 commit comments

Comments
 (0)