Class: Fastlane::Actions::RepackIosAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::RepackIosAction
- Defined in:
- lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
101 102 103 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 101 def self. ["Omer Duzyol", "Creaworks Labs"] end |
.available_options ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 115 def self. [ FastlaneCore::ConfigItem.new(key: :app_identifier, short_option: "-a", env_name: "FL_REPACK_IOS_APP_IDENTIFIER", description: "The bundle identifier of your app", optional: true, code_gen_sensitive: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier), default_value_dynamic: true), FastlaneCore::ConfigItem.new(key: :ipa, short_option: "-i", optional: true, env_name: "FL_REPACK_IOS_IPA", description: "Path to your original ipa file to modify", code_gen_sensitive: true, default_value: Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last, default_value_dynamic: true, verify_block: proc do |value| UI.user_error!("Could not find ipa file at path '#{File.(value)}'") unless File.exist?(value) UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with?(".ipa") end), FastlaneCore::ConfigItem.new(key: :entitlements, env_name: "FL_REPACK_IOS_ENTITLEMENTS", description: "Path to the entitlement file to use, e.g. `myApp/MyApp.entitlements`", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :display_name, env_name: "FL_REPACK_IOS_NAME", description: "Display name to force resigned ipa to use", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :version, env_name: "FL_REPACK_IOS_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: :short_version, env_name: "FL_REPACK_IOS_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_REPACK_IOS_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_REPACK_IOS_BUNDLE_ID", description: "Set new bundle ID during resign (`CFBundleIdentifier`)", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :match_type, env_name: "FL_REPACK_IOS_MATCH_TYPE", description: "Define the profile type, can be #{Match.environments.join(', ')} . Optional if you use _sigh_ or _match_", is_string: true, short_option: "-y", verify_block: proc do |value| unless Match.environments.include?(value) UI.user_error!("Unsupported environment #{value}, must be in #{Match.environments.join(', ')}") end end), FastlaneCore::ConfigItem.new(key: :output_name, env_name: "FL_REPACK_IOS_OUTPUT_NAME", description: "The name of the resulting app file inside the ipa file", is_string: true, optional: true), FastlaneCore::ConfigItem.new(key: :provisioning_profile, env_name: "FL_REPACK_IOS_PROVISIONING_PROFILE", description: "Path to your provisioning_profile. Optional if you use _sigh_ or _match_", 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: :contents, env_name: "FL_REPACK_IOS_CONTENTS", # The name of the environment variable description: "Path for the new contents", # a short description of this parameter verify_block: proc do |value| UI.user_error!("No path argument found for the new contents, pass using `contents: 'path-to-new-contents-folder'`") unless value && !value.empty? end) ] end |
.description ⇒ Object
97 98 99 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 97 def self.description "Enables your build pipeline to repack your pre-built ipa with new assets without rebuilding the native code." end |
.details ⇒ Object
111 112 113 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 111 def self.details "This plugin allows you to repack your existing .ipa packages with new assets or non-executable resources without rebuilding the native code. It supports fastlane's sigh and match actions to automatically detect provisioning profiles and certificates for resigning the modified ipa package." end |
.is_supported?(platform) ⇒ Boolean
210 211 212 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 210 def self.is_supported?(platform) platform == :ios end |
.output ⇒ Object
105 106 107 108 109 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 105 def self.output [ ['REPACK_IOS_IPA_ORIGINAL', 'Contains the new path name for the original ipa file'] ] end |
.run(params) ⇒ Object
13 14 15 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 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 |
# File 'lib/fastlane/plugin/repack_ios/actions/repack_ios_action.rb', line 13 def self.run(params) UI.important("Repack iOS started! 📦") UI.("Parameter Contents Path: #{params[:contents]}") UI.("Parameter IPA Path: #{params[:ipa]}") if params[:ipa].nil? || params[:output_name].nil? UI.important("Parameter ipa is empty, trying to resolve Gym configuration...") Gym.config = FastlaneCore::Configuration.create(Gym::Options., {}) output_directory = Gym.config[:output_directory] output_name = Gym.config[:output_name] ipa_path = "#{File.join(output_directory, output_name)}.ipa" UI.important("Parameter ipa resolved as '#{ipa_path}'") UI.user_error!("Resolved ipa file: #{File.(ipa_path)} is not exists. Please provide ipa path.") unless File.exist?(ipa_path) else ipa_path = params[:ipa] output_name = params[:output_name] end ipa_original_path = Helper::RepackIosHelper.unpack_and_repack(output_name, ipa_path, params[:contents]) UI.("Preparing to sign the new package") sigh_profile_type = Actions.lane_context[SharedValues::SIGH_PROFILE_TYPE] unless sigh_profile_type.nil? UI.important("Match type parameters obtained from sigh profile context!") params[:match_type] = sigh_profile_type.sub!('-', '') end # check match_type is passed? if !params[:match_type].nil? match_type = params[:match_type] UI.("Parameter Match Type: #{params[:match_type]}") provisioning_profile_key = "sigh_#{params[:app_identifier]}_#{match_type}_profile-path" # check if match has been executed before for the given app_identifier? if ENV[provisioning_profile_key].nil? UI.("Trying to match certificates with given type...") other_action.match( type: match_type, readonly: true ) end # read the provisioning_profile from sigh provisioning_profile = ENV[provisioning_profile_key] # otherwise, check provisioning_profile is not passed? elsif !params[:provisioning_profile].nil? UI.("Parameter Provisioning Profile: #{params[:provisioning_profile]}") end UI.("Resolving signing identity from provisioning profile...") signing_identity = Helper::RepackIosHelper.get_signing_identity_from_provision_profile(provisioning_profile) use_app_entitlements = params[:entitlements].nil? other_action.resign( ipa: File.(ipa_path), signing_identity: signing_identity, provisioning_profile: provisioning_profile, use_app_entitlements: use_app_entitlements, entitlements: params[:entitlements], version: params[:version], display_name: params[:display_name], short_version: params[:short_version], bundle_version: params[:bundle_version], bundle_id: params[:bundle_id] ) UI.important("iOS Repack completed! 📦 Original ipa can be found at '#{File.(ipa_original_path)}'") Actions.lane_context[SharedValues::REPACK_IOS_IPA_ORIGINAL] = File.(ipa_original_path) end |