Created
November 29, 2022 01:12
-
-
Save pacarvalho/fddc297d4d4b0266ebd2a63b02b55122 to your computer and use it in GitHub Desktop.
Medium - Continuous Deployment React Native to Apple App Store - Fastfile
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
# 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 "Deploy Production and Staging to TestFlight" | |
lane :deploy_all_to_testflight do | |
# ======================================================= | |
# Step 0: If running on the CICD we need to create a custom keychain | |
if ENV['CI'] | |
@api_key = app_store_connect_api_key( | |
key_id: ENV["APP_STORE_CONNECT_KEY_ID"], | |
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"], | |
key_content: ENV["APP_STORE_CONNECT_KEY"], | |
is_key_content_base64: true, | |
duration: 1200, | |
in_house: false | |
) | |
setup_ci | |
end | |
# ======================================================= | |
# Step 1: Increment the build number of this deploy | |
increment_build_number({ | |
xcodeproj: "my_app.xcodeproj", | |
build_number: latest_testflight_build_number({ app_identifier: "br.com.my_company.my_app", api_key: @api_key }) + 1 | |
}) | |
# ======================================================= | |
# Step 2: Attempt Deploy | |
# Sync the provisioning profiles | |
sync_code_signing(type: "appstore", app_identifier: 'br.com.my_company.my_app') | |
# Build the app | |
build_app( | |
workspace: "my_app.xcworkspace", | |
configuration: 'Release', | |
export_options: { | |
provisioningProfiles: { | |
"br.com.my_company.mmy_app" => "match AppStore br.com.my_company.mmy_app", | |
} | |
} | |
) | |
# Upload the build to testflight | |
upload_to_testflight( | |
skip_waiting_for_build_processing: true, | |
api_key: @api_key | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment