Class: Fastlane::Actions::ImportCertificateAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/import_certificate.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



47
48
49
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 47

def self.authors
  ["gin0606"]
end

.available_optionsObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 16

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :certificate_path,
                                 description: "Path to certificate",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :certificate_password,
                                 description: "Certificate password",
                                 sensitive: true,
                                 default_value: "",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :keychain_name,
                                 env_name: "KEYCHAIN_NAME",
                                 description: "Keychain the items should be imported to",
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :keychain_path,
                                 env_name: "KEYCHAIN_PATH",
                                 description: "Path to the Keychain file to which the items should be imported",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :keychain_password,
                                 env_name: "FL_IMPORT_CERT_KEYCHAIN_PASSWORD",
                                 description: "The password for the keychain. Note that for the login keychain this is your user's password",
                                 sensitive: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :log_output,
                                 description: "If output should be logged to the console",
                                 type: Boolean,
                                 default_value: false,
                                 optional: true)
  ]
end

.categoryObject



72
73
74
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 72

def self.category
  :code_signing
end

.descriptionObject



12
13
14
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 12

def self.description
  "Import certificate from inputfile into a keychain"
end

.detailsObject



55
56
57
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 55

def self.details
  "Import certificates (and private keys) into the current default keychain. Use the `create_keychain` action to create a new keychain."
end

.example_codeObject



59
60
61
62
63
64
65
66
67
68
69
70
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 59

def self.example_code
  [
    'import_certificate(certificate_path: "certs/AppleWWDRCA6.cer")',
    'import_certificate(
      certificate_path: "certs/dist.p12",
      certificate_password: ENV["CERTIFICATE_PASSWORD"] || "default"
    )',
    'import_certificate(
      certificate_path: "certs/development.cer"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



51
52
53
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 51

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



6
7
8
9
10
# File 'fastlane/lib/fastlane/actions/import_certificate.rb', line 6

def self.run(params)
  keychain_path = params[:keychain_path] || FastlaneCore::Helper.keychain_path(params[:keychain_name])

  FastlaneCore::KeychainImporter.import_file(params[:certificate_path], keychain_path, keychain_password: params[:keychain_password], certificate_password: params[:certificate_password], output: params[:log_output])
end