Last active
January 26, 2021 08:13
-
-
Save niggeulimann/67073fbcda0c6eff8d00ab3b38abf37c to your computer and use it in GitHub Desktop.
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
# ---------------------------------------- build -------------------------------------------------------- | |
lane :store do |options| | |
match_setup(readonly:false) | |
ipaPath = createIPA | |
deliver(username: ENV['MATCH_USERNAME'], | |
team_id: ENV['TEAM_ID'], | |
app_identifier: ENV['BUNDLE_ID'], | |
ipa: ipaPath, | |
skip_metadata:true, | |
skip_screenshots: true) | |
upload_symbols_to_crashlytics(gsp_path: ENV["GOOGLE_SERVICE_INFO_FILE_PATH"]) # Upload them to Crashlytics | |
#shout | |
trigger_slack_hook | |
end | |
lane :firestore do |options| | |
match_setup(readonly:false) | |
ipaPath = createIPA | |
firebase_app_distribution(ipa_path: ipaPath, | |
app: ENV['FIRE_APP'], | |
testers: "uli@jumero.de", | |
release_notes: build_notes_automated, | |
firebase_cli_path: ENV["FIREBASE_CLI_PATH"], | |
debug: true | |
) | |
upload_symbols_to_crashlytics(gsp_path: ENV["GOOGLE_SERVICE_INFO_FILE_PATH"]) # Upload them to Crashlytics | |
#shout | |
trigger_slack_hook | |
end | |
lane :createEnterpriseIPA do |options| | |
version = get_version_number(xcodeproj: ENV['XCODEPROJECT'], target: ENV['SCHEME'], configuration: ENV['CONFIGURATION']) | |
buildNo = get_build_number(xcodeproj: ENV['XCODEPROJECT']) | |
outputDir = "builds" | |
outputName = ENV["BASE_APP_NAME"]+"_" +ENV['NAME']+ "_v" +version+ "#" +buildNo | |
exportOptions = {:"method" => "enterprise", | |
:"provisioningProfiles" => { ENV['BUNDLE_ID'] => ENV['ENTERPRISE_EXPORT_PP_NAME']}} | |
if options[:addManifest] == true | |
exportOptions["manifest"] = { "appURL" => "https://jumero.app/download/cc_nightstand/\(outputName).ipa", | |
"displayImageURL" => "https://jumero.app/download/cc_nightstand/icon.CC.Nightstand.57.png", | |
"fullSizeImageURL" => "https://jumero.app/download/cc_nightstand/icon.CC.Nightstand.512.png"} | |
end | |
build_app(workspace: ENV['WORKSPACE'], | |
scheme: ENV['SCHEME'], | |
output_directory: "builds", | |
output_name: outputName + ".ipa", | |
configuration: ENV['CONFIGURATION'], | |
export_method: "enterprise", | |
export_options: exportOptions, | |
skip_profile_detection: true | |
) | |
upload_symbols_to_crashlytics(dsym_path: "builds/"+outputName+".app.dSYM.zip", gsp_path: ENV["GOOGLE_SERVICE_INFO_FILE_PATH"]) | |
#return path | |
outputDir + "/" + outputName | |
end | |
# --------------------------------------------- tests ------------------------------------------------------------- | |
desc "Run all tests" | |
lane :test do | |
run_tests(devices: ["iPhone 8"]) | |
end | |
# --------------------------------------------- utils ------------------------------------------------------------- | |
desc "downloads all existing dsyms from itunes connect and uploads it to crashlytics " | |
lane :refresh_dsyms do | |
download_dsyms(version:'latest', username: ENV['MATCH_USERNAME'], app_identifier: ENV['BUNDLE_ID']) # Download dSYM files from iTC | |
upload_symbols_to_crashlytics(gsp_path: ENV["GOOGLE_SERVICE_INFO_FILE_PATH"]) | |
clean_build_artifacts # Delete the local dSYM files | |
end | |
# ---------------------------------------- CERTIFICATE SETUP -------------------------------------------------------- | |
desc "The CI has no write access, so they will readonly" | |
lane :fetch_match_certs do | |
match_setup(readonly:true) | |
end | |
desc "There are two main scenarios for using this lane:" | |
desc "1. Initial setup of all needed certificates and profiles on your machine." | |
desc "2. Adding a new device to './fastlane/devices.txt'." | |
lane :match_setup do |options| | |
readonly = options[:readonly] == true | |
if readonly | |
git_url = ENV["MATCH_READONLY_URL"] | |
else | |
git_url = ENV["MATCH_URL"] | |
register_devices(devices_file: "./fastlane/devices.txt", username: ENV["MATCH_USERNAME"], team_id:ENV['TEAM_ID'], team_name:ENV['TEAM_NAME']) | |
remove_provisioning_profile(app_identifier: ENV["BUNDLE_ID"], type: "appstore") | |
end | |
match(readonly: readonly, | |
git_url: git_url, | |
git_branch: ENV["MATCH_TEAM_BRANCH"], | |
type: "appstore", | |
app_identifier: ENV["BUNDLE_ID"], | |
username: ENV["MATCH_USERNAME"], | |
verbose:true, | |
team_id:ENV['TEAM_ID'], | |
team_name:ENV['TEAM_NAME'], | |
force_for_new_devices: readonly, | |
force: readonly, | |
generate_apple_certs: true) | |
end | |
# --------------------------------------------- private helper ------------------------------------------------------ | |
private_lane :createIPA do |options| | |
version = get_version_number(xcodeproj: ENV['XCODEPROJECT'], target: ENV['SCHEME'], configuration: ENV['CONFIGURATION']) | |
buildNo = get_build_number(xcodeproj: ENV['XCODEPROJECT']) | |
outputDir = "builds" | |
outputName = ENV["BASE_APP_NAME"]+"_" +ENV['NAME']+ "_v" +version+ "#" +buildNo+".ipa" | |
build_app(workspace: ENV['WORKSPACE'], | |
scheme: ENV['SCHEME'], | |
output_directory: "builds", | |
output_name: outputName + ".ipa", | |
configuration: ENV['CONFIGURATION'], | |
export_method: "app-store", | |
skip_profile_detection: true, | |
xcargs: { :BUNDLE_IDENTIFIER => ENV['BUNDLE_ID'], | |
:PROVISIONING_PROFILE_SPECIFIER => "match AppStore de.getslash.cc.nightstand" | |
}, | |
) | |
#return path | |
outputDir + "/" + outputName | |
end | |
private_lane :build_notes_automated do | |
branch_name = git_branch | |
build_number_git = get_build_number_repository | |
build_notes = "Automated build for branch #{branch_name}. Last included commit number is #{build_number_git}.\n" | |
build_notes += "Current changes are: \n" | |
build_notes += read_changelog | |
puts("build_notes: " + build_notes) | |
build_notes | |
end | |
private_lane :trigger_slack_hook do |options| | |
changelog = build_notes_automated | |
# You can notify your team in chat that a beta build has been uploaded | |
rocket_chat(message: "Automated Nightstand-Build *"+ENV['SCHEME']+"* :rocket:\n\nCurrent changes are: \n```"+changelog+"```", | |
channel: "#deployments-mobile", | |
rocket_chat_url: ENV["ROCKET_CHAT_URL"], | |
success: true) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment