New to fastlane? Click hither to open the installation & setup instructions first
            xcode-select --install                      
            # Using RubyGems sudo jewel install fastlane -NV  # Alternatively using Homebrew brew install fastlane                      
            fastlane init                      

More Details

iOS Beta deployment using fastlane

Building your app

fastlane takes care of building your app using an action called build_app, only add together the following to your Fastfile:

          lane :beta do   build_app(scheme: "MyApp") cease                  

Additionally you can specify more options for building your app, for example

          lane :beta exercise   build_app(scheme: "MyApp",             workspace: "Example.xcworkspace",             include_bitcode: true) cease                  

Attempt running the lane using

          fastlane beta                  

If everything works, you should accept a [ProductName].ipa file in the current directory. To get a list of all available parameters for build_app, run fastlane activity build_app.

Codesigning

Chances are that something went incorrect because of code signing at the previous footstep. We prepared our ain Code Signing Guide that helps you lot setting up the right code signing arroyo for your projection.

Uploading your app

After building your app, it'due south ready to be uploaded to a beta testing service of your option. The beauty of fastlane is that you tin can easily switch beta provider, or even upload to multiple at once, without whatever extra work.

All y'all have to practice is to put the name of the beta testing provider of your choice later building the app using build_app:

          lane :beta do   sync_code_signing(type: "appstore")    # see code signing guide for more data   build_app(scheme: "MyApp")   upload_to_testflight   slack(message: "Successfully distributed a new beta build") end                  

fastlane automatically passes on information nigh the generated .ipa file from build_app to the beta testing provider of your choice.

To get a list of all available parameters for a given action, run

          fastlane action slack                  

Beta testing services

TestFlight

You tin easily upload new builds to TestFlight (which is part of App Store Connect) using fastlane. To exercise then, just use the congenital-in testflight action later building your app

            lane :beta do   # ...   build_app   upload_to_testflight stop                      

Some example apply cases

            lane :beta practise   # ...   build_app    # Variant 1: Provide a changelog to your build   upload_to_testflight(changelog: "Add rocket emoji")    # Variant ii: Skip the "Waiting for processing" of the binary   #   While this volition speed upwardly your build, it will not distribute   #   the binary to your tests, nor set a changelog   upload_to_testflight(skip_waiting_for_build_processing: true) end                      

If you used fastlane init to setup fastlane, your Apple ID is stored in the fastlane/Appfile. You tin can as well overwrite the username, using upload_to_testflight(username: "bot@fastlane.tools").

To become a list of all bachelor options, run

            fastlane activeness upload_to_testflight                      

With fastlane, you can also automatically manage your beta testers, cheque out the other actions bachelor.


Firebase App Distribution

Install the Firebase App Distribution plugin:

            fastlane add_plugin firebase_app_distribution                      

Authenticate with Firebase by running the firebase_app_distribution_login action (or using one of the other authentication methods):

            fastlane run firebase_app_distribution_login                      

And so add together the firebase_app_distribution activity to your lane:

            lane :beta do   # ...   build_app    firebase_app_distribution(     app: "i:123456789:ios:abcd1234",     groups: "qa-team, trusted-testers"   )   # ... cease                      

For more information and options (such as adding release notes) see the full Getting Started guide.


HockeyApp
            lane :beta do   # ...   build_app   hockey(api_token: "[insert_key_here]") end                      

To go your API token, open up API Tokens in Account Settings. From at that place, you lot tin can find your existing API token, or create a new one.

To become a list of all available options see the hockey activity docs, or run

            fastlane action hockey                      
TestFairy
            lane :beta do   # ...   build_app    testfairy(api_key: "[insert_key_here]")    # Variant i: Provide a changelog   testfairy(api_key: "[insert_key_here]",              comment: "Add rocket emoji")    # Variant two: Specify tester groups   testfairy(api_key: "[insert_key_here]", testers_groups: ["group1"]) terminate                      

To become a listing of all available options, run

            fastlane action testfairy                      

More than information well-nigh the service on TestFairy.com.

More information about additional supported beta testing services can be constitute in the list of "Beta" actions

Release Notes

Automatically based on git commits

Your changelog changes, then information technology doesn't make a lot of sense to store a static release note in the Fastfile.

            lane :beta practice   sync_code_signing   build_app    changelog_from_git_commits # this volition generate the changelog based on your last commits   upload_to_testflight finish                      

Get a listing of all available options using fastlane action changelog_from_git_commits, here are some examples

            changelog_from_git_commits(   between: ['7b092b3', 'HEAD'], # Optional, lets you specify a revision/tag range between which to collect commit info   merge_commit_filtering: 'exclude_merges' # Optional, lets you filter out merge commits )                      

Prompt for changelog

Y'all can automatically be asked for the changelog in your terminal using the prompt action:

            lane :beta do   # Variant 1: Ask for a one line input   changelog = prompt(text: "Changelog: ")    # Variant 2: Inquire for a multi-line input   #   The user confirms their input by typing `Finish` and Enter   changelog = prompt(     text: "Changelog: ",     multi_line_end_keyword: "END"   )    sync_code_signing   build_app    upload_to_testflight(changelog: changelog) finish                      

Fetching the changelog from the file system or remote server

You can fetch values from anywhere in your Fastfile, including the file system and remote server

            lane :beta do   # Variant ane: Read from file system   #   note the `..`, since fastlane runs in the _fastlane_ directory   changelog = File.read("../Changelog.txt")    # Variant 2: Fetch data from a remote spider web server   changelog = download(url: "https://lookatmycms.com/changelog.txt")    sync_code_signing   build_app    upload_to_testflight(changelog: changelog) end                      

All-time Practices

Manage devices and testers using fastlane
TestFlight

If you lot're using TestFlight you don't need to worry almost UDIDs of your devices. Instead you just maintain a list of testers based on their Apple ID email address.

fastlane supports automatically registering devices using dissimilar approaches

boarding

boarding allows you ready a registration page for your beta testers, so they can enter their email address and start testing your application.

/img/getting-started/ios/boarding-screenshot.png

Check out the boarding GitHub repo for more information.

pilot

pilot is automatically installed with fastlane, you can use information technology to register individual testers to TestFlight

              # Annals a new external tester fastlane pilot add email@invite.com  # Annals a new external tester and add together them to your app fastlane airplane pilot add email@invite.com -a com.app.name                          

Third party beta testing services

If you're using a 3rd party beta testing service, y'all'll need to manage your registered devices and their UDIDs. fastlane already supports device registrations and updating provisioning profiles out of the box.

              lane :beta practice   # Before calling match, we brand sure all our devices are registered on the Apple Programmer Portal   register_devices(devices_file: "devices.txt")    # After registering the new devices, we'll brand sure to update the provisioning profile if necessary   # Notation how we brand certain to pass "adhoc" to get and use a provisioning contour for Ad Hoc distribution   sync_code_signing(force_for_new_devices: true, type: "adhoc")   build_app   # ... cease                          

The devices.txt should wait like this:

              Device ID Device Name A123456789012345678901234567890123456789  DeviceName1 B123456789012345678901234567890123456789  DeviceName2                          
Incrementing the build number

Depending on the beta testing service you lot use, you'll take to increment the build number each time you upload a new build. This is a requirement for TestFlight for example.

To exercise so, there are some built-in fastlane deportment available, here are some examples

Fetching the latest build number from TestFlight

The code sample beneath will use the latest build number from TestFlight and temporarily set information technology.

            lane :beta practise   increment_build_number(     build_number: latest_testflight_build_number + i,     xcodeproj: "Instance.xcodeproj"   ) cease                      

Committing the build number to version control

The code sample beneath will increment the build number and commit the project changes to version control.

            lane :beta practice   # Ensure that your git status is non dingy   ensure_git_status_clean    # Increment the build number (not the version number)   # Providing the xcodeproj is optional   increment_build_number(xcodeproj: "Case.xcodeproj")    # Commit the version bump   commit_version_bump(xcodeproj: "Example.xcodeproj")    # Add a git tag for this build. This will automatically   # use an appropriate git tag name   add_git_tag    # Push the new commit and tag back to your git remote   push_to_git_remote end                      

For all the steps above, in that location are more than parameters bachelor, run the following to get a full list:

            fastlane action [action_name]                      

Use the number of commits

This isn't recommended, all the same some teams prefer this approach. You can use the number of commits of the current co-operative (via number_of_commits) as the build number. This will only work if you lot e'er run the build on the aforementioned branch.

            lane :beta do   increment_build_number(build_number: number_of_commits) end