$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: options[: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 :syncCodeSigning do |options| match( app_identifier: options[:app_identifier], type: options[:type] || "development", readonly: options[:readonly] || true, storage_mode: "git", git_url: options[:git_url], git_branch: "fastlane_certificates", keychain_password: options[:keychain_password], skip_docs: true, platform: "ios" ) end private_lane :getCodeSigning do |options| keychain_password = prompt( text: "Please enter your keychain password (account password): ", secure_text: true ) options[:readonly] = true options[:keychain_password] = keychain_password syncCodeSigning(options) end private_lane :updateCodeSigning do |options| options[:readonly] = false syncCodeSigning(options) end