iOS Development
4 min read

Automating iOS App Deployment using Fastlane

By Jibu JamesFeb. 2, 2017, 3 p.m. Application development company
Share This Article
Development process for the layperson and what does it take to build an application

Technology change is a constant and this means that software solutions have to be changed to leverage software solutions, boost business, reduce tech spends, or to provide enhanced customer experience.

Download Ebook

Table of Contents

Learn how to simplify the iOS app submission process and get your app on the App Store effortlessly. Read to know more!


Subscribe to Our Blog

We're committed to your privacy. SayOne uses the information you provide to us to contact you about our relevant content, products, and services. check out our privacy policy.

One of the most tedious tasks in iOS development is the submission of app in App Store. If you have ever tried to push an app into Apple Store, you know how lengthy the steps involved are - archiving the app, exporting it to App Store, adding the new build, adding screenshots for a particular device and finally make it available to the entire world. Fortunately a new tooling has evolved for the whole process, making it far easier -  fastlane.

What is Fastlane?

Fastlane is a collection of tools and the easiest way to automate deployments and release your iOS and Android apps. This article focuses on the iOS aspect. It handles all tedious tasks, like generating screenshots, dealing with code signing, and releasing the application. 

Why Fastlane?

Fastlane is not just a single tool. It is a collection of twelve tools(at the time of writing) for iOS which depend and interact with each other. fastlane is wrapped around these tools, allowing developers to define workflows, which also known as lanes. Each workflow requires different tools to run. For example, Snapshot is a tool which allows you to automatically take the screenshots of your app.

A typical workflow in fastlane looks like this:

 

lane :appstore do
  snapshot                  # Generate screenshots of app for the App Store
  gym                           # Build your app
  deliver                      # Upload the screenshots of app and the binary to iTunes
end

Here you define a lane to generate screenshots, build app and upload binary to iTunes.

The Fastlane Toolchain

The list of Fastlane tools also called Fastlane commands is given below:

  • Deliver :Upload screenshots, metadata, and app to the App Store
  • Snapshot :Automate taking screenshots of iOS app on every device
  • Frameit:Quickly put screenshots into the right device frames
  • Pem:Automatically generate and renew push notification profiles
  • Sigh:create provisioning profiles
  • Produce:Create new iOS apps on iTunes Connect and Developer Portal from the command line
  • Cert:Automatically create and maintain iOS code signing certificates
  • Scan:The easiest way to run tests of iOS and Mac app
  • Gym:Used to build iOS app 
  • Match:Easily sync certificates and profiles across your team using Git

How to use Fastlane in iOS App?

Installation: Before you start using fastlane, you need to make sure that the Xcode Command Line Tools are installed. Execute xcode-select --install from command line to install it. Fastlane is a Ruby gem. Depending on the system, you have to either run gem install fastlane or sudo gem install fastlane.

Setting up Fastlane in iOS project: After creating your Xcode project, move it to the project folder and run fastlane init from the command line. Then a script will prompt you for your apple ID and probably password if it is not present in the keychain. The script also detects the different attributes of your app such as name and identifier, and checks the Developer Portal and iTunes Connect if the app is already present. If it isn't, then it offers to create it for you .

After  the setup process, you can see a newly created fastlane directory. The file is named as fastfile which contains all your existing metadata fetched from iTunes Connect. The most interesting thing about Fastfile is that it contains all the information that is needed to distribute your app. Here is the default appstore lane.

lane :appstore do
  match(type: "appstore")
  snapshot
  gym
  deliver(force: true)
  frameit
end

This lane or workflow does the following things:

  • match - fetch all signing certificates and provisioning profiles.
  • snapshot -create screenshots for your application .
  • gym - generate build  of your app for the app store .
  • deliver -upload screenshots, metadata, and the archive to iTunes Connect.
  • frameit -create marketing images with device frames from your screenshots.


What's next?

Fastlane has already created all the essential files. You can now customise it using the different tools available to generate screenshots or to automatically distribute new builds etc. You can also connect Slack and fastlane in order to notify teams through messages in a channel once the app is processing, or has been publishing, or when unit test are failing etc.

Advantages of Fastlane

The main advantage of fastlane is that it saves much time when you release an update or new app. Others are listed below

  • Does not rely only on one person for releasing updates.
  • Boosts software quality and reaction time with smaller releases.
  • Stores everything in git. Never look up build commands again.
  • Deploys an update of your app to the App Store with just one command.

Conclusion

By using Fastlane, you can reduce the time and effort needed to deploy an app to App Store through automating the different steps. Fastlane also offers a ton of integrations which helps to customize your lanes to get real time feedback on Slack, perform unit tests and deploy TestFlight builds. For more information, check out the documentation on GitHub

To learn more about this fantastic tool, take a look at the official fastlane website.

Share This Article

Subscribe to Our Blog

We're committed to your privacy. SayOne uses the information you provide to us to contact you about our relevant content, products, and services. check out our privacy policy.