How to deploy to iTunes Connect TestFlight?

To auto deploy to iTunes Connect TestFlight:

  1. Add the Deploy to iTunes Connect / TestFlight (with Deliver) or the Deploy to iTunes Connect / TestFlight (with Shenzhen) step to your workflow, after the Xcode Archive or Xamarin Archive step (once the signed IPA is available, so if you use a Sign or Re-sign step to sign the IPA you should add the deploy step after that), and specify your iTunes Connect login credentials for the Deploy to iTunes Connect / TestFlight … step (preferably through Secret Environment Variables).
    • In general the Deliver tool based step is probably better, as it’s more up to date and supports more features, but it uses a reverse engineered iTunes Connect API, which might break when Apple changes it. That said the Fastlane guys (who are the developers of the deliver tool) are quite quick to adapt to these changes. Shenzhen uses Xcode tools, but it supports only the basics of TestFlight submission (uploading the IPA).
  2. Make sure that the app (.ipa) is signed for App Store distribution, as iTunes Connect only supports that.
    • If you use the Xcode Archive or Export … Xcode archive step to generate the signed IPA, all you have to do is to set the Select method for export input of the step to app-store. If you use a different Team ID for app store signing than the one you do regular signing with, you also have to set the The Developer Portal team to use for this export option, but if you use the same team this is not required.
    • And of course don’t forget to upload the required app store code signing files (code signing docs).
  3. It might be a good idea to auto set the build number to the BITRISE_BUILD_NUMBER, as iTunes Connect requires a unique build number for every upload.

That’s all!

An example configuration (used for one of our sample apps we test iTunes Connect TestFlight submissions with):

---
format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
  envs:
  - BITRISE_PROJECT_PATH: "./Bitrise-iTunesConnectBetaTest/Bitrise-iTunesConnectBetaTest.xcodeproj"
  - BITRISE_SCHEME: Bitrise-iTunesConnectBetaTest
  - INFO_PLIST_PATH: "./Bitrise-iTunesConnectBetaTest/Bitrise-iTunesConnectBetaTest/Info.plist"
trigger_map:
- push_branch: "*"
  workflow: deploy-to-test-flight
workflows:
  deploy-to-test-flight:
    steps:
    - activate-ssh-key@3.1.1:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@3.4.1: {}
    - certificate-and-profile-installer: {}
    - set-xcode-build-number:
        title: Set Build Number
        inputs:
        - plist_path: "$INFO_PLIST_PATH"
    - xcode-archive:
        title: Archive for App Store
        inputs:
        - export_method: app-store
    - deploy-to-itunesconnect-deliver:
        inputs:
        - itunescon_user: "$ITUNES_CONNECT_USER"
        - password: "$ITUNES_CONNECT_PASSWORD"
        - app_id: "$ITUNES_CONNECT_APP_ID"
        - team_name: "$ITUNES_CONNECT_TEAM_NAME"
    - deploy-to-bitrise-io:
        run_if: 
        inputs:
        - notify_user_groups: none
        - notify_email_list: ''

Note if you want to use this configuration: don’t forget to specify the following environment variables, preferably as Secret Environment Variables:

  • ITUNES_CONNECT_USER
  • ITUNES_CONNECT_PASSWORD
  • ITUNES_CONNECT_APP_ID
  • ITUNES_CONNECT_TEAM_NAME

If you have any questions, just let us know!

Happy Building! :slight_smile:

4 Likes

Thanks for a great walkthrough! -
Where can I auto set the BITRISE_BUILD_NUMBER ?

1 Like

@alejandro_chacin You can use the Set Xcode Project Build Number step for that.

Related discussions (with more info/details):

Has this step been renamed? I only see “Deploy to iTunes Connect” and “Deploy to iTunes Connect - Application Loader”. I’m not clear on the difference between those two either.

1 Like

Hi @danielsmith_deutsch! The step was indeed renamed, or rather replaced, the difference between the current ones is that the Application Loader one uses Apple’s official solution by the same name, while other Deploy to iTunes step uses Fastlane’s deliver action.

1 Like

@viktorbenei, how are you handling Apple’s MFA use case?

@andoanakqa we’re recommending using App-specific passwords to surpass Two Factor Authentication. These can be created here.

1 Like

Hi @bitce is there a way I can dynamically set the :

  • ITUNES_CONNECT_USER
  • ITUNES_CONNECT_PASSWORD
  • ITUNES_CONNECT_APP_ID
  • ITUNES_CONNECT_TEAM_NAME

For example, I have a few clients all with different creds, and Id like to dynamically push through bitrise based on the different clients without having to add it in every time? I collect this info from the clients.

Thanks