Class: Fastlane::Actions::GetCertificatesAction

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

Direct Known Subclasses

CertAction

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, authors, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject



57
58
59
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 57

def self.author
  "KrauseFx"
end

.available_optionsObject



45
46
47
48
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 45

def self.available_options
  require 'cert'
  Cert::Options.available_options
end

.categoryObject



76
77
78
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 76

def self.category
  :code_signing
end

.descriptionObject



34
35
36
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 34

def self.description
  "Create new iOS code signing certificates (via _cert_)"
end

.detailsObject



38
39
40
41
42
43
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 38

def self.details
  [
    "**Important**: It is recommended to use [match](https://docs.fastlane.tools/actions/match/) according to the [codesigning.guide](https://codesigning.guide) for generating and maintaining your certificates. Use _cert_ directly only if you want full control over what's going on and know more about codesigning.",
    "Use this action to download the latest code signing identity."
  ].join("\n")
end

.example_codeObject



65
66
67
68
69
70
71
72
73
74
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 65

def self.example_code
  [
    'get_certificates',
    'cert # alias for "get_certificates"',
    'get_certificates(
      development: true,
      username: "[email protected]"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



61
62
63
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 61

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



50
51
52
53
54
55
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 50

def self.output
  [
    ['CERT_FILE_PATH', 'The path to the certificate'],
    ['CERT_CERTIFICATE_ID', 'The id of the certificate']
  ]
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'fastlane/lib/fastlane/actions/get_certificates.rb', line 9

def self.run(params)
  require 'cert'

  return if Helper.test?

  begin
    # Only set :api_key from SharedValues if :api_key_path isn't set (conflicting options)
    unless params[:api_key_path]
      params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
    end

    Cert.config = params # we alread have the finished config

    Cert::Runner.new.launch
    cert_file_path = ENV["CER_FILE_PATH"]
    certificate_id = ENV["CER_CERTIFICATE_ID"]
    Actions.lane_context[SharedValues::CERT_FILE_PATH] = cert_file_path
    Actions.lane_context[SharedValues::CERT_CERTIFICATE_ID] = certificate_id

    UI.success("Use signing certificate '#{certificate_id}' from now on!")

    ENV["SIGH_CERTIFICATE_ID"] = certificate_id # for further use in the sigh action
  end
end