cert/lib/cert/runner.rb in fastlane-2.119.0 vs cert/lib/cert/runner.rb in fastlane-2.120.0.beta.20190325200020
- old
+ new
@@ -10,11 +10,11 @@
module Cert
class Runner
def launch
run
- installed = FastlaneCore::CertChecker.installed?(ENV["CER_FILE_PATH"])
+ installed = FastlaneCore::CertChecker.installed?(ENV["CER_FILE_PATH"], in_keychain: ENV["CER_KEYCHAIN_PATH"])
UI.message("Verifying the certificate is properly installed locally...")
UI.user_error!("Could not find the newly generated certificate installed", show_github_issues: true) unless installed
UI.success("Successfully installed certificate #{ENV['CER_CERTIFICATE_ID']}")
return ENV["CER_FILE_PATH"]
end
@@ -90,25 +90,29 @@
end
path = store_certificate(certificate, Cert.config[:filename])
private_key_path = File.expand_path(File.join(Cert.config[:output_path], "#{certificate.id}.p12"))
- if FastlaneCore::CertChecker.installed?(path)
+ # As keychain is specific to macOS, this will likely fail on non macOS systems.
+ # See also: https://github.com/fastlane/fastlane/pull/14462
+ keychain = File.expand_path(Cert.config[:keychain_path])
+ if FastlaneCore::CertChecker.installed?(path, in_keychain: keychain)
# This certificate is installed on the local machine
ENV["CER_CERTIFICATE_ID"] = certificate.id
ENV["CER_FILE_PATH"] = path
+ ENV["CER_KEYCHAIN_PATH"] = keychain
UI.success("Found the certificate #{certificate.id} (#{certificate.name}) which is installed on the local machine. Using this one.")
return path
elsif File.exist?(private_key_path)
- keychain = File.expand_path(Cert.config[:keychain_path])
password = Cert.config[:keychain_password]
FastlaneCore::KeychainImporter.import_file(private_key_path, keychain, keychain_password: password)
FastlaneCore::KeychainImporter.import_file(path, keychain, keychain_password: password)
ENV["CER_CERTIFICATE_ID"] = certificate.id
ENV["CER_FILE_PATH"] = path
+ ENV["CER_KEYCHAIN_PATH"] = keychain
UI.success("Found the cached certificate #{certificate.id} (#{certificate.name}). Using this one.")
return path
else