Get your iOS project on the Fastlane — Upload to testflight
Previously we talked about project setup for multiple environments, fastlane setup and how to manage your profiles with match & also upload to firebase app distribution. This is the final post of the series and I will show you how to upload to testflight your production builds and distribute them to your testers.
First, we will use match to create our production provisioning profiles. So open your terminal, navigate to your projects folder and type
fastlane match appstore
and follow the guide. This will create your production certificates if needed, provisioning profiles will install them into your keychain and will also add them to the git repo (or google cloud storage) you specified during your match initialisation.
Ok, now that we got out production certificates open your fastfile and add the following to your fastfile
desc "Builds Release-Production & uploads to App Store Connect"
lane :app_store domatch(type: 'appstore', app_identifier: ['com.max.MyAwesomeApp', 'com.max.MyAwesomeApp.widget'])scan(fail_build=true)gym(
project: 'MyAwesomeApp.xcodeproj',
scheme: 'Release-Production',
configuration: 'Release-Production',
clean: true,
output_directory: 'archives',
output_name: 'MyAwesomeApp.ipa',
export_method: 'app-store'
)pilot(
username: "apple id mail",
team_id: "app store connect team id",
app_identifier: 'com.max.MyAwesomeApp',
app_platform: 'ios',
ipa: "archives/MyAwesomeApp.ipa",
skip_waiting_for_build_processing: true
)end
Let’s break it down a little. We use match to manage our certificates and provisioning profiles, and install them on our machine if they don’t exist. Remember we previously created them, but if we move to another machine or run this on our Jenkins server, our profiles and our certificate might not be installed on the keychain. Match will take care of it.
Next, we run scan with an extra argument. What this arg does it to tell scan to stop our build if our tests fail. We don’t want to distribute a build that its tests are failing to our users anyway.
Gym is where we build our app. We are using our Release-Production config for this build.
Next comes pilot. Pilot is an alias for the upload_to_testflight action. Pilod will upload the binary file produces by gym to the app store connect. I prefer to skip waiting for the processing since sometimes it might take a while and i manually do the job of releasing the app to testers.
Well this is the end of these my iOS fastlane journey. I hope you all enjoyed it.
Comments
Post a Comment