iOS Continuous Integration and Delivery using Bitrise and Fastlane — Part 3

Abedalkareem Omreyh
4 min readJun 26, 2019

--

This is a part of a series about iOS continuous integration and delivery.

Part 1: Install Fastlane

Part 2: Match, increment version number, increment build number and add badge actions.

Part 4: Bitrise!

Part 5: Workflows and Triggers

In the second part, we added Match action to generate the certificates and profiles for our app also we added a badge to our app icon to show the version and build number for our app, in this part we are going to use two new actions to upload our app to test flight!.

gym

gym action builds and packages iOS apps for you. It takes care of all the heavy lifting and makes it super easy to generate a signed ipa.

Now in our Fastlane file add the gym action after the add_badge action.

gym

The final look after adding gym action to our file:

Run the fastlane beta command line again and wait until it finishes building.

Now go to your project folder you will find that you have an ipa generated for you!

Now, How to upload the build to TestFlight?

Pilot

We will upload the build using another action called Pilot, Pilot is an action from Fastlane to manage your TestFlight testers and builds from your terminal.

Open the Fastfile again and after the gym action add:

pilot(username: “your_user_name”)

The final look after adding pilot action to our file:

Now go back to your app and in the Info.plist add a new key

ITSAppUsesNonExemptEncryption

with boolean value NO.

To know more about this value please visit session 302 from WWDC.

Run the fastlane beta again, and wait until it finishes.

If you go to iTunes connect you will find that there is a new build uploaded to your tester!.

Slack

Next thing we will do, whenever the build uploaded successfully or if something went wrong, we will send a message to slack. For that, we will use another action called slack.

After pilot action add the following action:

slack(message: "App successfully released!")

You can change the message with whatever you want. Now if you try to run the beta lane, it will ask you about the WebHook for your slack group, if you don’t want to be asked about this again you can add the slack_url parameter with the URL to your group.

slack(message: "App successfully released!", slack_url: "your_group_url")

To get the WebHook URL from slack:

1- Go to apps “https://yourgroup.slack.com/apps”.

2- Search for “Incoming WebHooks”.

3- Click on “Add Configuration”.

4- It will ask you to select a channel to post to, select any channel you want.

5- Click on add.

6- Now copy the “Webhook URL” and add it to the slack_url parameter.

The final look after adding slack action to our file:

Run the beta lane again, and wait until it finishes. You will see that you got a success message from Fastlane!

Tests Lane

In this lane we will run the unit tests inside our app, it’s a simple lane that contains two actions, the scan action, and slack action.

The scan actions is an action from Fastlane to run the app unit tests.

scan

The final look of our tests lane:

After we reached to this point we have done most of the work, and actually using just this locally will save a lot of time for you!. but with Bitrise we will save even more time and make things even better!.

Part 4: Bitrise!

If you faced any problem you can add a comment below or send me a message on Twitter or facebook.

--

--