Created
June 5, 2020 05:55
-
-
Save vitalbone/4b7ee744fef5d3185bc4595664e49058 to your computer and use it in GitHub Desktop.
Example React Native Fastfile (match, build, App Center deploys, TestFlight distribution)
This file contains hidden or 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
# This file contains the fastlane.tools configuration | |
# You can find the documentation at https://docs.fastlane.tools | |
# | |
# For a list of all available actions, check out | |
# | |
# https://docs.fastlane.tools/actions | |
# | |
# For a list of all available plugins, check out | |
# | |
# https://docs.fastlane.tools/plugins/available-plugins | |
# | |
# Uncomment the line if you want fastlane to automatically update itself | |
# update_fastlane | |
default_platform(:ios) | |
platform :ios do | |
desc 'Fetch certificates and provisioning profiles' | |
lane :certificates do |options| | |
if options[:is_ci] | |
match( | |
app_identifier: ENV["IOS_BUNDLE_ID"], | |
keychain_name: ENV["KEYCHAIN_NAME"], | |
keychain_password: ENV["KEYCHAIN_PASSWORD"], | |
force_for_new_devices: true, | |
type: options[:cert_type] | |
) | |
else | |
match( | |
app_identifier: ENV["IOS_BUNDLE_ID"], | |
force_for_new_devices: true, | |
type: options[:cert_type] | |
) | |
end | |
end | |
desc 'Bump the build version and push update to repo' | |
lane :bump_build_version do | |
increment_build_number(xcodeproj: './MyCoolApp.xcodeproj') | |
commit_version_bump(message: 'Bump iOS build', xcodeproj: './MyCoolApp.xcodeproj') | |
git_pull | |
push_to_git_remote | |
end | |
desc 'Build IPA' | |
lane :build do |options| | |
if options[:is_ci] | |
setup_local_keychain | |
end | |
cocoapods(podfile: "./Podfile") | |
certificates(is_ci:options[:is_ci], cert_type:options[:cert_type]) | |
build_app(scheme: "MyCoolApp", | |
workspace: "MyCoolApp.xcworkspace", | |
include_bitcode: true, | |
export_method: options[:build_type]) | |
end | |
desc 'Setup CI flag' | |
lane :setupCI do | |
setup_ci( | |
force: true | |
) | |
end | |
desc 'Setup local keychain, likely only required in CI container which does not have a keychain.' | |
lane :setup_local_keychain do | |
create_keychain( | |
name: ENV["KEYCHAIN_NAME"], | |
password: ENV["KEYCHAIN_PASSWORD"], | |
default_keychain: true, | |
unlock: true, | |
timeout: 3600, | |
lock_when_sleeps: false | |
) | |
end | |
desc 'Do all build related tasks and then deploy to MS AppCenter' | |
lane :build_and_deploy do |options| | |
sync_code_signing(type: "appstore") | |
build(is_ci:options[:is_ci], build_type:"development", cert_type:"development") | |
appcenter_upload( | |
api_token: ENV["APPCENTER_API_TOKEN"], | |
owner_name: ENV["APPCENTER_APP_OWNER_NAME"], | |
owner_type: ENV["APPCENTER_APP_OWNER_TYPE"], | |
app_name: ENV["APPCENTER_IOS_APP_NAME"], | |
destination_type: "group", | |
destinations: ENV["APPCENTER_BETA_GROUP_NAME"], | |
file: ENV["IOS_IPA_FILE"], | |
dsym: ENV["IOS_DSYM_FILE"], | |
notify_testers: false | |
) | |
end | |
desc 'Upload distribution build to the iOS App Store Connect' | |
lane :release do |options| | |
sync_code_signing(type: "appstore") | |
increment_build_number( | |
build_number: app_store_build_number(live: false) + 1, | |
xcodeproj: "MyCoolApp.xcodeproj" | |
) | |
increment_version_number(version_number: options[:version]) | |
build(is_ci:options[:is_ci], build_type:"app-store", cert_type:"appstore") | |
upload_to_app_store( | |
force: true, | |
submit_for_review: false, | |
app_version: options[:version] | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment