Created
April 29, 2015 19:33
-
-
Save darrarski/bfd321c7a5531724746e to your computer and use it in GitHub Desktop.
Fastlane.tools action that creates and signs iOS app build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fastlane | |
module Actions | |
module SharedValues | |
IPA_OUTPUT_PATH = :IPA_OUTPUT_PATH | |
end | |
class BuildSignedIpaAction < Action | |
def self.run(params) | |
workspace_path = params[:workspace_path] | |
scheme = params[:scheme] | |
configuration = params[:configuration] | |
sdk = params[:sdk] | |
build_path = params[:build_path] | |
app_name = params[:app_name] | |
sign_identity = params[:sign_identity] | |
mobileprovision_path = params[:mobileprovision_path] | |
Helper.log.info 'Building application...' | |
Actions.sh [ | |
"xctool", | |
"clean", | |
"build", | |
"-workspace", "\"#{workspace_path}\"", | |
"-scheme", "\"#{scheme}\"", | |
"-configuration", "\"#{configuration}\"", | |
"-sdk", "\"#{sdk}\"", | |
"ONLY_ACTIVE_ARCH=NO", | |
"CONFIGURATION_BUILD_DIR=\"#{build_path}\"" | |
].join(" ") | |
Helper.log.info 'Creating signed IPA file...' | |
ipa_path = "#{build_path}/#{app_name}.ipa" | |
Actions.sh [ | |
"xcrun", | |
"-log", | |
"-sdk", "#{sdk}", | |
"PackageApplication" , | |
"\"#{build_path}/#{app_name}.app\"", | |
"-o", "\"#{ipa_path}\"", | |
"-sign", "\"#{sign_identity}\"", | |
"-embed", "\"#{mobileprovision_path}\"" | |
].join(" ") | |
Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH] = "#{ipa_path}" | |
end | |
def self.description | |
"Clean and build using xctool then create IPA with xcrun PackageApplication" | |
end | |
def self.available_options | |
[ | |
['workspace_path', 'Path to .xcworkspace file'], | |
['scheme', 'Build scheme'], | |
['configuration', 'Build configuration (e.g. "Release")'], | |
['sdk', 'SDK to use (e.g. "iphoneos")'], | |
['build_path', 'Build directory path'], | |
['app_name', 'Application name'], | |
['sign_identity', 'Signing identity (e.g. "iPhone Distribution: MyCompany")'], | |
['mobileprovision_path', 'Path to .mobileprovision file'] | |
] | |
end | |
def self.output | |
[ | |
['IPA_OUTPUT_PATH', 'Path to IPA file'] | |
] | |
end | |
def self.author | |
"Darrarski" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment