Class: Fastlane::Actions::ResignAction

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

Overview

Resigns the ipa

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, details, 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

.authorObject


123
124
125
# File 'fastlane/lib/fastlane/actions/resign.rb', line 123

def self.author
  "lmirosevic"
end

.available_optionsObject


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'fastlane/lib/fastlane/actions/resign.rb', line 46

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :ipa,
                                 env_name: "FL_RESIGN_IPA",
                                 description: "Path to the ipa file to resign. Optional if you use the _gym_ or _xcodebuild_ action",
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
                                 default_value_dynamic: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :signing_identity,
                                 env_name: "FL_RESIGN_SIGNING_IDENTITY",
                                 description: "Code signing identity to use. e.g. `iPhone Distribution: Luka Mirosevic (0123456789)`"),
    FastlaneCore::ConfigItem.new(key: :entitlements,
                                 env_name: "FL_RESIGN_ENTITLEMENTS",
                                 description: "Path to the entitlement file to use, e.g. `myApp/MyApp.entitlements`",
                                 conflicting_options: [:use_app_entitlements],
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :provisioning_profile,
                                 env_name: "FL_RESIGN_PROVISIONING_PROFILE",
                                 description: "Path to your provisioning_profile. Optional if you use _sigh_",
                                 default_value: Actions.lane_context[SharedValues::SIGH_PROFILE_PATH],
                                 default_value_dynamic: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   files = case value
                                           when Hash then value.values
                                           when Enumerable then value
                                           else [value]
                                           end
                                   files.each do |file|
                                     UI.user_error!("Couldn't find provisiong profile at path '#{file}'") unless File.exist?(file)
                                   end
                                 end),
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "FL_RESIGN_VERSION",
                                 description: "Version number to force resigned ipa to use. Updates both `CFBundleShortVersionString` and `CFBundleVersion` values in `Info.plist`. Applies for main app and all nested apps or extensions",
                                 conflicting_options: [:short_version, :bundle_version],
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :display_name,
                                 env_name: "FL_DISPLAY_NAME",
                                 description: "Display name to force resigned ipa to use",
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :short_version,
                                 env_name: "FL_RESIGN_SHORT_VERSION",
                                 description: "Short version string to force resigned ipa to use (`CFBundleShortVersionString`)",
                                 conflicting_options: [:version],
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :bundle_version,
                                 env_name: "FL_RESIGN_BUNDLE_VERSION",
                                 description: "Bundle version to force resigned ipa to use (`CFBundleVersion`)",
                                 conflicting_options: [:version],
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :bundle_id,
                                 env_name: "FL_RESIGN_BUNDLE_ID",
                                 description: "Set new bundle ID during resign (`CFBundleIdentifier`)",
                                 is_string: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :use_app_entitlements,
                                 env_name: "FL_USE_APP_ENTITLEMENTS",
                                 description: "Extract app bundle codesigning entitlements and combine with entitlements from new provisionin profile",
                                 conflicting_options: [:entitlements],
                                 is_string: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :keychain_path,
                                 env_name: "FL_RESIGN_KEYCHAIN_PATH",
                                 description: "Provide a path to a keychain file that should be used by `/usr/bin/codesign`",
                                 is_string: true,
                                 optional: true)
  ]
end

.categoryObject


42
43
44
# File 'fastlane/lib/fastlane/actions/resign.rb', line 42

def self.category
  :code_signing
end

.descriptionObject


16
17
18
# File 'fastlane/lib/fastlane/actions/resign.rb', line 16

def self.description
  "Codesign an existing ipa file"
end

.example_codeObject


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'fastlane/lib/fastlane/actions/resign.rb', line 20

def self.example_code
  [
    'resign(
      ipa: "path/to/ipa", # can omit if using the `ipa` action
      signing_identity: "iPhone Distribution: Luka Mirosevic (0123456789)",
      provisioning_profile: "path/to/profile", # can omit if using the _sigh_ action
    )',
    '# You may provide multiple provisioning profiles if the application contains nested
    # applications or app extensions, which need their own provisioning profile.
    # You can do so by passing an array of provisiong profile strings or a hash
    # that associates provisioning profile values to bundle identifier keys.
    resign(
      ipa: "path/to/ipa", # can omit if using the `ipa` action
      signing_identity: "iPhone Distribution: Luka Mirosevic (0123456789)",
      provisioning_profile: {
        "com.example.awesome-app" => "path/to/profile",
        "com.example.awesome-app.app-extension" => "path/to/app-extension/profile"
      }
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:


127
128
129
# File 'fastlane/lib/fastlane/actions/resign.rb', line 127

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

.run(params) ⇒ Object


5
6
7
8
9
10
11
12
13
14
# File 'fastlane/lib/fastlane/actions/resign.rb', line 5

def self.run(params)
  require 'sigh'

  # try to resign the ipa
  if Sigh::Resign.resign(params[:ipa], params[:signing_identity], params[:provisioning_profile], params[:entitlements], params[:version], params[:display_name], params[:short_version], params[:bundle_version], params[:bundle_id], params[:use_app_entitlements], params[:keychain_path])
    UI.success('Successfully re-signed .ipa 🔏.')
  else
    UI.user_error!("Failed to re-sign .ipa")
  end
end