passforios/fastlane/Fastfile
2020-12-29 19:44:00 -08:00

180 lines
5.5 KiB
Ruby

default_platform :ios
lane :prepare do
cocoapods
carthage(cache_builds: true, platform: "iOS")
sh "./scripts/gopenpgp_build.sh"
end
lane :reset_build_number do
increment_build_number(
build_number: 0,
xcodeproj: "pass.xcodeproj"
)
end
lane :match_development do
app_identifier = "me.mssun.passforios"
match(
type: "development",
git_url: "https://github.com/mssun/certificates-passforios",
git_basic_authorization: ENV['MATCH_GIT_BASIC_AUTHORIZATION'],
keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
app_identifier: [app_identifier,
"#{app_identifier}.find-login-action-extension",
"#{app_identifier}.auto-fill-credential-extension",
"#{app_identifier}.shortcuts"],
readonly: true
)
end
lane :match_appstore do
app_identifier = "me.mssun.passforios"
match(
type: "appstore",
git_url: "https://github.com/mssun/certificates-passforios",
git_basic_authorization: ENV['MATCH_GIT_BASIC_AUTHORIZATION'],
keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
app_identifier: [app_identifier,
"#{app_identifier}.find-login-action-extension",
"#{app_identifier}.auto-fill-credential-extension",
"#{app_identifier}.shortcuts"],
readonly: true
)
end
lane :match_appstore_beta do
app_identifier = "me.mssun.passforiosbeta"
match(
type: "appstore",
git_url: "https://github.com/mssun/certificates-passforios",
git_basic_authorization: ENV['MATCH_GIT_BASIC_AUTHORIZATION'],
keychain_name: ENV["MATCH_KEYCHAIN_NAME"],
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
app_identifier: [app_identifier,
"#{app_identifier}.find-login-action-extension",
"#{app_identifier}.auto-fill-credential-extension",
"#{app_identifier}.shortcuts"],
readonly: true
)
end
platform :ios do
desc "Runs all tests"
lane :test do
run_tests()
end
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :beta do
app_identifier = "me.mssun.passforiosbeta"
create_keychain(
name: ENV["MATCH_KEYCHAIN_NAME"],
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: false,
unlock: true,
timeout: 3600,
add_to_search_list: true
)
if is_ci?
match_appstore_beta
end
increment_build_number(
build_number: latest_testflight_build_number(
version: get_version_number(target: "pass"),
app_identifier: app_identifier,
initial_build_number: 0
) + 1,
xcodeproj: "pass.xcodeproj"
)
build_app(
scheme: "pass",
configuration: "Beta",
skip_profile_detection: true,
export_options: {
method: "app-store",
provisioningProfiles: {
app_identifier => "match AppStore #{app_identifier}",
"#{app_identifier}.find-login-action-extension" => "match AppStore #{app_identifier}.find-login-action-extension",
"#{app_identifier}.auto-fill-credential-extension" => "match AppStore #{app_identifier}.auto-fill-credential-extension",
"#{app_identifier}.shortcuts" => "match AppStore #{app_identifier}.shortcuts",
},
},
verbose: true
)
upload_to_testflight(
app_identifier: app_identifier,
skip_waiting_for_build_processing: true
)
if is_ci?
notify_dev
end
end
desc "Submit a new build to AppStore"
lane :release do
app_identifier = "me.mssun.passforios"
create_keychain(
name: ENV["MATCH_KEYCHAIN_NAME"],
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: false,
unlock: true,
timeout: 3600,
add_to_search_list: true
)
if is_ci?
match_appstore
end
increment_build_number(
build_number: latest_testflight_build_number(
version: get_version_number(target: "pass"),
app_identifier: app_identifier,
initial_build_number: 0
) + 1,
xcodeproj: "pass.xcodeproj"
)
build_app(
scheme: "pass",
configuration: "Release",
skip_profile_detection: true,
export_options: {
method: "app-store",
provisioningProfiles: {
app_identifier => "match AppStore #{app_identifier}",
"#{app_identifier}.find-login-action-extension" => "match AppStore #{app_identifier}.find-login-action-extension",
"#{app_identifier}.auto-fill-credential-extension" => "match AppStore #{app_identifier}.auto-fill-credential-extension",
"#{app_identifier}.shortcuts" => "match AppStore #{app_identifier}.shortcuts",
},
},
verbose: true
)
upload_to_testflight(
app_identifier: app_identifier,
skip_waiting_for_build_processing: true
)
if is_ci?
notify_dev
end
end
desc 'Notify developers'
lane :notify_dev do
mailgun(
postmaster: ENV["MY_POSTMASTER"],
apikey: ENV["MY_API_KEY"],
to: ENV["DESTINATION_EMAIL"],
from: ENV["EMAIL_FROM_NAME"],
reply_to: ENV["EMAIL_REPLY_TO"],
subject: "A new build of Pass for iOS has been uploaded",
success: true,
app_link: "https://github.com/mssun/passforios",
ci_build_link: "https://github.com/mssun/passforios/actions",
message: "A new build has been uploaded by GitHub Action.",
)
end
end