108 lines
2.9 KiB
Plaintext
108 lines
2.9 KiB
Plaintext
$appName = File.basename(Dir['../*.xcworkspace'].first, '.*')
|
|
|
|
private_lane :beforeBuild do |options|
|
|
appName = options[:appName] || $appName
|
|
podsReposPath = File.expand_path "~/.cocoapods/repos/master/"
|
|
lockFilePath = "#{podsReposPath}/.git/index.lock"
|
|
|
|
# check if .lock file exists in pod repos - then remove all master repo
|
|
if File.exists? lockFilePath
|
|
sh("rm -rf #{podsReposPath}")
|
|
end
|
|
|
|
carthage(platform: "iOS")
|
|
|
|
cocoapods(
|
|
clean: true,
|
|
repo_update: true
|
|
)
|
|
|
|
set_info_plist_value(
|
|
path: "./#{appName}/Info.plist",
|
|
key: "CFBundleVersion",
|
|
value: options[:buildNumber] || 10000
|
|
)
|
|
end
|
|
|
|
private_lane :afterBuild do |options|
|
|
appName = options[:appName] || $appName
|
|
podsReposPath = File.expand_path "~/.cocoapods/repos/master/"
|
|
lockFilePath = "#{podsReposPath}/.git/index.lock"
|
|
|
|
# check if .lock file exists in pod repos - then remove all master repo
|
|
if File.exists? lockFilePath
|
|
sh("rm -rf #{podsReposPath}")
|
|
end
|
|
|
|
carthage(platform: "iOS")
|
|
|
|
cocoapods(
|
|
clean: true,
|
|
repo_update: true
|
|
)
|
|
|
|
set_info_plist_value(
|
|
path: "./#{appName}/Info.plist",
|
|
key: "CFBundleVersion",
|
|
value: options[:buildNumber] || 10000
|
|
)
|
|
end
|
|
|
|
private_lane :buildConfiguration do |options|
|
|
beforeBuild(options)
|
|
|
|
configuration = lane_context[SharedValues::LANE_NAME]
|
|
method = configuration.start_with?("Enterprise") ? "enterprise" : "development"
|
|
appName = options[:appName] || $appName
|
|
uploadToFabric = options[:uploadToFabric]
|
|
icloudEnvironment = options[:iCloudContainerEnvironment] || ""
|
|
exportOptions = icloudEnvironment.to_s.empty? ? {} : {iCloudContainerEnvironment: icloudEnvironment}
|
|
exportOptions[:compileBitcode] = options[:compileBitcode] || false
|
|
|
|
gym(
|
|
clean: true,
|
|
workspace: "./#{appName}.xcworkspace",
|
|
scheme: appName,
|
|
archive_path: "./",
|
|
output_directory: "./",
|
|
output_name: "#{appName}.ipa",
|
|
configuration: configuration,
|
|
export_method: method,
|
|
export_options: exportOptions,
|
|
skip_package_ipa: !uploadToFabric
|
|
)
|
|
|
|
afterBuild(options)
|
|
end
|
|
|
|
private_lane :createPushCertificate do |options|
|
|
certificates_path = File.expand_path "../certificates"
|
|
Dir.mkdir(certificates_path) unless File.directory?(certificates_path)
|
|
|
|
get_push_certificate(
|
|
development: true,
|
|
generate_p12: true,
|
|
active_days_limit: 30, # create new certificate if old one will expire in 30 days
|
|
save_private_key: false,
|
|
app_identifier: options[:app_identifier],
|
|
p12_password: "123", # empty password won't work with Pusher
|
|
output_path: certificates_path
|
|
)
|
|
end
|
|
|
|
private_lane :syncCodeSignning do |options|
|
|
keychain_password = prompt(
|
|
text: "Please enter your keychain password (account password): ",
|
|
secure_text: true
|
|
)
|
|
|
|
match(
|
|
app_identifier: options[:app_identifier],
|
|
type: "development",
|
|
readonly: true,
|
|
storage_mode: "git",
|
|
git_url: "git@github.com:petropavel13/FastlaneCertificates.git",
|
|
keychain_password: keychain_password
|
|
)
|
|
end
|