How to Distribute a Build to TestFlight in CI
upload_to_testflight (aliased pilot) pushes a signed IPA to TestFlight using an App Store Connect API key, no Apple ID password required.
After building a signed IPA, call upload_to_testflight with the API key. Set skip_waiting_for_build_processing if you do not need to block CI on Apple processing.
Steps
- Authenticate with
app_store_connect_api_key. - Build the signed IPA in the same lane.
- Call
upload_to_testflight(ipa: "...")to submit the build.
Fastfile
Fastfile
lane :beta do
api_key = app_store_connect_api_key(
key_id: ENV["ASC_KEY_ID"],
issuer_id: ENV["ASC_ISSUER_ID"],
key_content: ENV["ASC_KEY_B64"],
is_key_content_base64: true
)
build_app(scheme: "MyApp", export_method: "app-store")
upload_to_testflight(
api_key: api_key,
skip_waiting_for_build_processing: true
)
endGotchas
- The bundle version (build number) must be higher than the last uploaded build or TestFlight rejects it.
skip_waiting_for_build_processingreturns fast but export-compliance may still gate the build in App Store Connect.