Skip to content

Instantly share code, notes, and snippets.

@vizllx
Last active August 15, 2018 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vizllx/3bb0cbbee0f381753c46f13f70d6bb36 to your computer and use it in GitHub Desktop.
Save vizllx/3bb0cbbee0f381753c46f13f70d6bb36 to your computer and use it in GitHub Desktop.
default_platform :ios
puts "Upload to Testflight"
fastlane_require 'dotenv'
fastlane_require 'trainer'
ENV['FASTLANE_XCODEBUILD_SETTINGS_RETRIES'] = "120" // this is required to run to retry the xcode build job to retry if fails
//avoid hardcoding password try to access the password from Jenkins environment variable script
ENV['FASTLANE_PASSWORD'] = "12app1@12" . // your itunes connect passowrd
lane :uploadToBeta do
# build your iOS app
//avoid hardcoding password try to access the password from Jenkins environment variable script
unlock_keychain(path: "login.keychain", password:" 12345") // need to unlock keychain for accesing private key for provisoning profile
clean_build_artifacts # Delete the local dSYM files
clear_derived_data
clean_cocoapods_cache
desc "Increment version number"
xcodeproj = "./app1.xcodeproj"
target = ENV['SCHEME']
version = get_build_number_from_plist(
xcodeproj: xcodeproj,
target: target,
)
version_array = version.split(".").map(&:to_i)
#version_array[0] = version_array[0] + 1
#version_array[1] = version_array[1] = 0
#version_array[1] = version_array[2] = 0
version_array[4] = version_array[4] + 1
next_version_number = version_array.join(".")
puts next_version_number
puts "Using build number: #{version}"
increment_build_number_in_plist(
build_number: next_version_number,
target: ENV['SCHEME']
)
gym(
scheme: ENV['SCHEME'],
export_method:"app-store"
export_xcargs: "-allowProvisioningUpdates",
include_bitcode: false,
export_options: {
uploadBitcode: false,
uploadSymbols: false,
compileBitcode: false,
provisioningProfiles: {
ENV['BUNDLE_IDENTIFIER'] => ENV['PROVISION_NAME_APPSTORE']
},
"signingStyle": "manual"
}
)
desc "upload to Testflight"
pilot(changelog:"#{:last_git_commit_message}",app_identifier: ENV['BUNDLE_IDENTIFIER'],skip_waiting_for_build_processing: true,notify_external_testers:true,distribute_external:true,groups: ["testers"])
desc "Send notification in Slack"
slack(
message: "Testflight build of #{ENV['APP_NAME']}- Version- #{next_version_number} is uploaded successfully. It will be available in Testflight soon , depends on iTunes's processing time . Thanks :) ",
success: true,
use_webhook_configured_username_and_icon: true,
slack_url: "https://hooks.slack.com/services/ss/sss/sss",
default_payloads: [:git_branch, :last_git_commit_message],
attachment_properties: {
fields: [
{
title: "Build number",
value: "#{next_version_number}",
}
]
}
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment