Class: Fastlane::Actions::SyncCodeSigningAction

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

Direct Known Subclasses

MatchAction

Constant Summary

Constants inherited from Fastlane::Action

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

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

Class Method Details

.authorsObject



92
93
94
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 92

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



77
78
79
80
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 77

def self.available_options
  require 'match'
  Match::Options.available_options
end

.categoryObject



109
110
111
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 109

def self.category
  :code_signing
end

.define_profile_type(params) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 25

def self.define_profile_type(params)
  profile_type = "app-store"
  profile_type = "ad-hoc" if params[:type] == 'adhoc'
  profile_type = "development" if params[:type] == 'development'
  profile_type = "enterprise" if params[:type] == 'enterprise'

  UI.message("Setting Provisioning Profile type to '#{profile_type}'")

  Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE] = profile_type
end

.define_provisioning_profile_mapping(params) ⇒ Object

Maps the bundle identifier to the appropriate provisioning profile This is used in the gym action as part of the export options e.g.

export_options: {
  provisioningProfiles: { "me.themoji.app.beta": "match AppStore me.themoji.app.beta" }
}


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 44

def self.define_provisioning_profile_mapping(params)
  mapping = Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING] || {}

  # Array (...) to make sure it's an Array, Ruby is magic, try this
  #   Array(1)      # => [1]
  #   Array([1, 2]) # => [1, 2]
  Array(params[:app_identifier]).each do |app_identifier|
    env_variable_name = Match::Utils.environment_variable_name_profile_name(app_identifier: app_identifier,
                                                                                      type: Match.profile_type_sym(params[:type]),
                                                                                  platform: params[:platform])

    if params[:derive_catalyst_app_identifier]
      app_identifier = "maccatalyst.#{app_identifier}"
    end

    mapping[app_identifier] = ENV[env_variable_name]
  end

  Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING] = mapping
end

.descriptionObject



69
70
71
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 69

def self.description
  "Easily sync your certificates and profiles across your team (via _match_)"
end

.detailsObject



73
74
75
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 73

def self.details
  "More information: https://docs.fastlane.tools/actions/match/"
end

.example_codeObject



100
101
102
103
104
105
106
107
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 100

def self.example_code
  [
    'sync_code_signing(type: "appstore", app_identifier: "tools.fastlane.app")',
    'sync_code_signing(type: "development", readonly: true)',
    'sync_code_signing(app_identifier: ["tools.fastlane.app", "tools.fastlane.sleepy"])',
    'match   # alias for "sync_code_signing"'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



96
97
98
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 96

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.outputObject



82
83
84
85
86
87
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 82

def self.output
  [
    ['MATCH_PROVISIONING_PROFILE_MAPPING', 'The match provisioning profile mapping'],
    ['SIGH_PROFILE_TYPE', 'The profile type, can be app-store, ad-hoc, development, enterprise, can be used in `build_app` as a default value for `export_method`']
  ]
end

.return_valueObject



89
90
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 89

def self.return_value
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'fastlane/lib/fastlane/actions/sync_code_signing.rb', line 9

def self.run(params)
  require 'match'

  params.load_configuration_file("Matchfile")

  # 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

  Match::Runner.new.run(params)

  define_profile_type(params)
  define_provisioning_profile_mapping(params)
end