Integrate Fastlane to iOS project: Lesson 9

Upload the app to TestFlight

Mark
2 min readSep 8, 2018

Last lesson, we talk about how to update Fastlane and run pod install before build the app in Fastfile.

This time, we will talk about how to use pilot action to upload the build to TestFlight and add Release configuration in environment file.

Upload Build to TestFlight

When we upload the build to TestFlight, we will use Release configuration instead of Adhoc configuration. Create a file called .env_testing_release under /fastlane folder.

The reason we create a new environment file instead of using .env_testing_adhoc is that they are using different configuration, we cannot specify different configurations (both Adhoc and Release) in a single environment file.

If you don’t have a Xcode scheme to archive the release configuration, create one and use _<env>_release as suffix.

Add a new lane to Fastfile

// Fastfile
lane
:submit_to_testflight do
cocoapods()
match()
gym()
pilot()
end
// .env_testing_release
MATCH_GIT_BRANCH = <branch_name>
MATCH_APP_IDENTIFIER = <your_app_id>
MATCH_TYPE = appstore
MATCH_READONLY = true # if false, cannot create the certificates and provisioning profile
# Fastlane Gym
GYM_SCHEME = Bookshop_testing_release
GYM_WORKSPACE = Bookshop.xcworkspace
GYM_CLEAN = true
GYM_CONFIGURATION = Release
GYM_BUILD_PATH = fastlane_delivery/testing/release/
GYM_ARCHIVE_PATH = fastlane_delivery/testing/release/bookshop_dev_release
GYM_DERIVED_DATA_PATH = fastlane_delivery/testing/release/
GYM_OUTPUT_DIRECTORY = fastlane_delivery/testing/release/
# Crashlytics
# no release for Crashlytics
# Hockey
# no release for Hockey
# TestFlight
PILOT_USERNAME = <iTunes_connect_username> # apple id
PILOT_APP_IDENTIFIER = <bundle_id>
PILOT_PLATFORM = ios
PILOT_IPA = ./fastlane_delivery/testing/release/Bookshop-testing-release.ipa
PILOT_SKIP_SUBMISSION = true
PILOT_NOTIFY_EXTERNAL_TESTERS = false
PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING = true

We don’t distribute the app to testers in pilot, the reason is we want to check the app within internal first. You can set the options so it will notify the testers in your TestFlight account.

Now, run bundle exec fastlane ios submit_to_testflight --env testing_release, it will upload the build to TestFlight.

What’s next?

Next lesson, we will integrate Slack with your iOS, you will got a slack message while Fastlane helps you to build the app.

--

--