Class: Fastlane::Actions::AddDevelopmentCertificatesToProvisioningProfilesAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



67
68
69
70
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 67

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ['Automattic']
end

.available_optionsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 42

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app_identifier,
                                 description: 'List of App Identifiers that should contain the new device identifier',
                                 type: Array,
                                 verify_block: proc do |value|
                                                 UI.user_error!('You must provide an array of bundle identifiers in `app_identifier`') if value.empty?
                                               end),
    FastlaneCore::ConfigItem.new(key: :team_id,
                                 description: 'The team_id for the provisioning profiles',
                                 type: String,
                                 verify_block: proc do |value|
                                                 UI.user_error!('You must provide a team ID in `team_id`') unless value && !value.empty?
                                               end),
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 34

def self.description
  'Add dev certificates to provisioning profiles'
end

.detailsObject



38
39
40
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 38

def self.details
  "Add all team member's development certificates to profiles associated with the provided bundle identifiers"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 72

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

.outputObject



59
60
61
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 59

def self.output
  # This lane doesn't provide variables that other lanes can consume.
end

.return_valueObject



63
64
65
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 63

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb', line 4

def self.run(params)
  require 'spaceship'

  Spaceship.
  Spaceship.select_team(team_id: params[:team_id])

  all_certificates = Spaceship.certificate.all(mac: false).select do |certificate|
    certificate.owner_type == 'teamMember'
  end

  params[:app_identifier].each do |identifier|
    Spaceship.provisioning_profile.find_by_bundle_id(bundle_id: identifier)
             .select do |profile|
      profile.is_a? Spaceship::Portal::ProvisioningProfile::Development
    end
             .tap do |profiles|
      UI.important "Warning: Unable to find any profiles associated with #{identifier}" if profiles.empty?
    end
             .each do |profile|
      profile.certificates = all_certificates
      profile.update!
      UI.success "Applied #{all_certificates.length} certificates to #{profile.name}"
    end
  end
end