TestFlight iOS app distribution

This guide shows how to configure iOS app distribution from Semaphore to Apple TestFlight using Fastlane.

For an introduction to building iOS apps on Semaphore, see the iOS tutorial.

First, make sure to configure your project to use Fastlane, Match and code signing by following the Code signing for iOS projects guide.

To publish to TestFlight, create a separate Fastlane lane where you'll invoke the appropriate commands:

# fastlane/Fastfile
platform :ios do
  desc "Submit the app to TestFlight"
  lane :release do
    match(type: "appstore")
    gym
    pilot
  end
end

For the whole process to work, make sure you've configured environment variables required for match and pilot. Namely, the URL for match's certificate repository, the encryption password for it, and Apple ID for logging in to the Apple Developer portal and submitting a new build. This is described in detail in the Code signing for iOS projects guide.

In your Semaphore CI/CD configuration, you can now use bundle exec fatlane build command in a job:

# .semaphore/semaphore.yml
version: v1.0
name: Semaphore iOS example
agent:
  machine:
    type: a1-standard-4
    os_image: macos-mojave
blocks:
  - name: Submit to TestFlight
    task:
      env_vars:
        - name: LANG
          value: en_US.UTF-8
      secrets:
        - name: fastlane-env
        - name: ios-cert-repo
      prologue:
        commands:
          - checkout
          - bundle install --path vendor/bundle
      jobs:
        - name: Fastlane build
          commands:
            - bundle exec fastlane release

Semaphore maintains an example open source iOS project with working Fastlane and Semaphore configuration for your convenience.

Still need help? Contact Us Contact Us