Lesson 4 - Install Fastlane for IOS to push IPA to Firebase Distribution and Testflight
04/02/2023 - 5 phút
Summary
The concept
- .IPA files are iOS and iPados app archive files that store iOS/iPados apps. Each .IPA file consists of a binary and can only be installed on ARM-based iOS, iPados, or MacOS devices. Files with the .IPA extension can be uncompressed by changing the extension to .zip and unzipping. Most .ipa files cannot be installed on iPhone emulators because they do not contain binaries for x86, ARM ant of mobile phones and tablets. To run applications on the emulator, native project files can be opened using the Xcode SDK. However, some .ipa files can be opened on the emulator by extracting and copying over the .APP file found in the payload folder. Some simple applications can run on the emulator through this method.
- Apple Developer account is one of the most important processes in IOS application development, when running, debugging, exporting .ipa installation files or uploading apps to Testflight. There are 2 types of accounts
- Apple Developer Program for Individuals ($99/Year): For individuals.
- Membership Program for Organizations ($299/Year): For organizations and companies.
- Apple Distribution Certificates is a certificate that identifies whether the account has the authority to upload the app to the product’s appstore. For a $99 account, a maximum of 3 certificates can only be created.
- Apple Development Certificates are certificates used for development purposes only. Supports all devices, and can only create up to 12 certificates for a $99 account.
Instruct
- Configure Fastlane and push the IPA to Firebase Distribution
- Configure Fastlane and push Testflight
Configure Fastlane and push IPA to Firebase Distribution
Create an App Name for your Android project by clicking the Android icon on the Firebase dashboard
- Enter Apple bundle ID and click “Register app”
Download the file GoogleService-Info.plist and click “Next
After downloading, we open xcode with the command
open ios/ReactNativeDevOps.xcworkspace
Next we drag the downloaded file into xcode
Next, select the image and select OK
Next, select Next
Next, select Next
Continue to select ” Continue to console “
After successful registration, you will have the ios section on the dashboard page
So I have successfully registered iOS on Firebase
Next, we will enable Firebase Distribution
We select Firebase Distribution in the right menu, then select IOS
Next select Get started
So we have successfully enabled Firebase Distribution
Build .IPA
You need an Apple Developer Account to perform this step
- Create Certificates Distribution:
We access the link to create: https://developer.apple.com/account then select Certificates
We open Keychain Access and select Certificate Assistant -> Request a Certificate From a Certificate Authority..
Next, enter your email and select Saved to disk
Select the newly created icon
Next select Apple Distribution and click Continue
Select the file CertificateSigningRequest.certSigningRequest just created above
Click continue and download the created file
Double click on the newly downloaded file and import it into keychain accounts and check if the file has been imported
So the file has been imported, let’s continue to create Provisioning Profile Ad Hoc
We select the menu on the left Profiles
Continue to select Continue
Continue to select Continue
We select the newly created Certificate and click Continue
Select the device to be used, in this part we are building Ad Hoc so we need to add additional devices to the build
Next, choose a name for the file and select Generate then download the file
Double click on the newly downloaded file and import it into keychain accounts
Next we use the fastlane init command to add the iOS build kit
fastlane init
Next we choose number 4
Next we add the firebase_app_distribution plugin
fastlane add_plugin firebase_app_distribution
Continue updating the file ios->fastlane->Fastfile
# 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
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "180"
ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "180"
default_platform(:ios)
platform :ios do
desc "Push a new beta build to firebase"
lane :firebase do |options|
clear_derived_data
clean_build_artifacts
build_app(
export_options: {
method: "ad-hoc",
provisioningProfiles: {
"com.reactnativedevops" => "Provisioning Profile react native depops"
}
}
)
puts "+---------------------------------+".bold.blue
puts "|-- FIREBASE_CLI_TOKEN: #{ENV['FIREBASE_CLI_TOKEN']} 🚀 --|".bold.blue
puts "|-- FIREBASE_APP_ID: #{ENV['FIREBASE_APP_ID']} 🚀 --|".bold.blue
puts "+---------------------------------+".bold.blue
firebase_app_distribution(
app: "1:320882145170:ios:56b45da6b925693e65b34b",
firebase_cli_token: "1//0gP2yENNqCT1oCgYIARAAGBASNwF-L9IrqQI9gih5h73FSmaozzyn0HSQXxS7Vyyav2h4zEk4ClMbgmz6CwbEShz_qJVMmTxiGas"
)
end
end
firebase_app_distribution part app vs firebase_cli_token, you can see in the previous post, I have instructions in the previous post, continue using the command fastlane firebase
fastlane firebase
So you have successfully built and uploaded to firebase. Let’s continue to log in to the firebase console to see if the file has been uploaded.
So I have successfully built, and uploaded the build version 1 to Firebase Distribution
Configure Fastlane and push Testflight
Step 1: Create identifiers
Continue selecting Continue
Select App and click Continue
Continue entering Description and **Bundle ID **
So we have successfully created identifiers for the app with the package name com.reactnativedevops
Continue to go to the appconnect home page to create a New App
So we have successfully created New App with app name React Native Devops
Continue updating the ios->fastlane->Fastfile file to add the new build config section
desc "Push a new beta build to TestFlight"
lane :beta do |options|
clear_derived_data
clean_build_artifacts
build_app(
scheme: "Release",
export_options: {
method: "app-store",
provisioningProfiles: {
"com.reactnativedevops" => "Provisioningdevopsstore"
}
}
)
upload_to_testflight(
notify_external_testers:true,
skip_waiting_for_build_processing:true
)
end
Continue updating the ios->fastlane->Appfile file to add the new build config section
# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username
app_identifier("com.reactnativedevops") # The bundle identifier of your app
apple_id("tdduy.dev@gmail.com") # Your Apple email address
itc_team_id("") # App Store Connect Team ID
team_id("") # Developer Portal Team ID
# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
After updating, we use the command fastlane beta -verbose to build
fastlane beta -verbose
After the build was successful, my app was on testflight
So I have shared with you how to build for iOS through fastlane. Thank you for reading my article.