Automate Fabric Beta distribution with Fastlane

Mateusz Tylman on 5 September 2018

Managing the publishing new versions of beta applications can be a pain. You must remember about updating the version’s number, setting up the right target or choosing specific emails from the list on Fabric. It’s easy to forget about one of these things when the newest version of the app is ready. That’s why I decided to use the fantastic Fastlane tool which enabled me to fully automate those actions.

In this article, I am going to describe how to configure this tool so that you can implement Fastlane in your project by yourself. We’re going to add a fastfile file, which we’ll use to automatically upgrade the app’s version, generate the build and share it with Fabric. Additionally, it will push a new commit informing about a new version. Let’s start!

  1. Installing Fastlane

To install Fastlane, you need to execute the command in the terminal:

After successful installation, you’ll get the message:

  1. Preparing the project for installation

When building Fastlane, you’ll use the ready-made actions defined in Fastlane. Some of them require an appropriate preparation of your project.

To enable automatic upgrade of the project’s version, you need to switch on avgtool

You need to go to the Build Settings tab in the target, then search for the ‘versioning’ phrase.

Then set up:

– Current Project Version na 1 (or other value)

– Versioning System na Apple Generic

Additionally, the graphics have to be in A.B.C. format

Let’s remember here about the correct setting of the provisioning profile. A good way of sorting out the signing of the app versions is adding separate targets to the ad-hoc versions and App Store.

  1. Initializing Fastfile

You begin the project integration with Fastlane by creating a fastfile file. You then get to the main folder of your project in the terminal and then use the command:

The configuration starts with the question whether you want to use one of the ready-made templates:

However, you’re configuring the project yourself, so you use the option number 4. After a while, there will display a message about the successful configuration of Fastlane. Additionally, you need to confirm a few tips by clicking the enter button.

Now, the project should like this:

You probably noticed that apart from the fastlane folder, in which there are Appfile  and Fastfile  files, the configurator generated also 2 Gemfile  files. They are used to manage versions so that everyone who works on the same project will use the same versions of gems.

In this article, we will skip this stage (if you’re interested, there’s a link to the documentation: and get straight to Fastfile.

  1. Configuring fastfile

Let’s open our freshly generated fastfile using the editor. I recommend the free Visual Studio Code program to which you can install an iOS Common Files (link: itemName=Orta.vscode-ios-common-files) plugin which automatically chooses the language and colors the syntax.

Fastfile consists of the so-called lanes. In the simplest terms, a single lane can be understood as a function in which actions are taken in a row. Let’s define a few global variables which will make it easier to take actions.

The texts written with Caps Lock need to be filled in according to their description. Thanks to variables defined this way, we keep the order and readability of our code. Additionally, all generated builds will be saved in a separate build folder which will be created later on.

  1. Creating lanes

Let’s create a few lanes responsible for minor functionalities and then connect them into one (it will be responsible for building and sharing a new version on Fabric). Let’s start with putting a higher number of the version and build.

Thanks to the earlier preparation of the project, we’ll use ready actions (url:

As you can see, it’s a piece of cake. We used ready actions which do all the work for us.

It’s now time to use a lane responsible for archiving ad-hoc versions. To do this, we’ll use a properly configured build_app  action. Additionally, we’ll check if a build folder exists, and if not, we’ll create it.

Let’s now add another lane, this time one responsible for sharing versions through Fabric and sending dSYM files. Let’s remember to complement earlier global variables with the keys to Crashlytics.

The last step will be to send the commit with a tag informing about the version number.

The lanes we created are ready to be used. Let’s add the last one, which will launch then all.

A fastfile file created this way will enable us to generate a new build and share it on Fabric.

  1. Launching

To launch the lane we created, let’s go again to the main folder of our project in the terminal. Let’s execute:

The whole process may take a while (after all, we’re creating an application). However, if we configured the project properly and filled in data in globals, at the end, we should get a message about the successful generation of a version

Congratulations! You just created a new version of your app, shared it with selected email addresses through Fabric and sent a commit informing about the increased version number. And all that using just one command!

You can download final fastfile from:

Tagi: , , , ,

You might also like

Leave a Reply

Your email address will not be published. Required fields are marked *

[sociallocker id="1419"] DOWNLOAD E-BOOK [/sociallocker]
Check Appchance web and mobile app services
Learn how to grow
your business using
a mobile app
I have read and accepted the terms of use.