Skip to content

04 Fastlane

Igor Lamos edited this page Aug 5, 2017 · 2 revisions

Section 04 Fastlane

Lecture 01 Overview

Fastlane is the easiest way to automate beta deployments and releases for your iOS and Android apps. It handles all tedious tasks, like dealing with code signing and releasing your application (with generating screenshots, uploading app's metadata etc.).

Meet the fastlane family

iOS

  • produce: Create new iOS app on iTunes Connect and Dev Portal
  • spaceship: Ruby library to access the Apple Dev Center and iTunes Connect
  • cert: Automatically create and maintain iOS code signing certificates
  • sigh: Create, renew, download and repair provisioning profiles for your iOS app
  • match: Easily sync your certificates and profiles across your team using Git
  • snapshot: Automate taking localized screenshots of your iOS app on every device
  • frameit: Quickly put your screenshots into the right device frames
  • boarding: The easiest way to invite your TestFlight beta testers
  • pilot: The best way to manage your TestFlight testers and builds from your terminal
  • gym: Building your iOS apps has never been easier
  • scan: The easiest way to run tests for your iOS app
  • precheck: Check your app using a community driven set of App Store review rules to avoid being rejected
  • deliver: Upload your iOS app with screenshots & metadata to the App Store
  • pem: Automatically generate and renew your push notification profiles for iOS app

Android

  • screengrab: Automate taking localized screenshots of your Android app on every device
  • supply: Upload your Android app with its metadata to Google Play Store

Links

Why use Fastlane?

  • Save days of preparing application submission and releasing the application
  • Don't rely on one person releasing updates.
  • Increase software quality and reaction time with more frequent and smaller releases.
  • Ship your mobile application from any computer or server.

Lecture 02 Code Signing Guide

https://codesigning.guide

A best practices guide on how to manage certificates and provisioning profiles in your development team.

See also Apple's docs for more info.

Lecture 03 Pre-installation Steps

Setup separate Apple ID for Fastlane

Best practice is to create separate Apple ID for your Fastlane deployments. I have devised a fictitious identity called Linda to do automated such tasks for me. Her email is [email protected], so I've created an Apple ID for her with this email. After you have created separate Apple ID, you have to do the following:

  • Invite this user to your Team at Apple Developer Portal as an Admin. Login to Apple Developer Portal, select "People" in the left menu and click "Invite" blue button in the middle-top of the screen. Enter Apple ID email address that was just created in the "Invite as Admin" textbox. You have to confirm the invitation in the email sent to this email address.
  • Add this user to iTunes Connect in the "Users and Roles" as an "App Manager" for "All apps".

Create new PRIVATE repository for holding Apple certificates

As discussed in the previous Lecture, you have to create a separate PRIVATE Git repository, which will be holding your certificates and provisioning profiles for iOS Code Signing. I will use it later in this course. Important note here: You need only one repository for this purpose for all your projects, not separate one for each of your projects. For example, I'm using: https://github.com/beplus/apple-certificates. In this repository, I have all certificates and all provisioning profiles for all of my mobile apps.

Create separate VCS account for Fastlane

I've created Linda Bot (https://github.com/linda-bot). Using this account, you will be working with your Git repositories - either project's or the special one for Apple certificates.

Setup access to your Git repositories using this newly created account from your computer using SSH.

  1. Generate SSH key:
    ssh-keygen -t rsa -b 4096 -C "[email protected]"
  2. Add the key to SSH agent (if you want to access Github from your local computer):
    # Start the ssh-agent in the background.
    eval "$(ssh-agent -s)"
    
    # Add your SSH private key to the ssh-agent.
    ssh-add -K ~/.ssh/[email protected]_rsa
  3. Copy the contents of Public Key to Clipboard
    # Copy the contents of the [email protected]_rsa.pub file to your clipboard.
    pbcopy < ~/.ssh/[email protected]_rsa.pub

GitHub

You can find a simple guide for Github here:

  1. Add your new SSH public key to your Github account: Github > Settings > SSH and GPG keys > New SSH key > paste the contents from Clipboard > Add SSH key.
  2. Add the separate user account (Linda for me) as a collaborator with Write access to your repositories (project & Apple certificates).

Gitlab

You can find a simple guide for Gitlab here:

  1. Add your new SSH public key to your Gitlab account: Gitlab > Settings > SSH keys tab > paste the contents from Clipboard to Textarea and provide Title > Add key.
  2. Add the separate user account (Linda for me) as a collaborator with Write access to your repositories (project & Apple certificates).

Bitbucket

You can find a simple guide for Bitbucket here:

  1. Add your new SSH public key to your Bitbucket account: Bitbucket > Bitbucket settings > SSH keys in the left menu > Add key > paste the contents from Clipboard to Textarea and provide Label > Add key.
  2. Add the separate user account (Linda for me) as a collaborator with Write access to your repositories (project & Apple certificates).

Lecture 04 Fastlane Installation

DO NOT INSTALL FASTLANE GLOBALLY

It is recommended that you use a Gemfile to define your dependency on Fastlane. This will clearly define the used Fastlane version, and its dependencies, and will also speed up using Fastlane.

Do the following steps in both ./ios and ./android directories.

  1. Install bundler using sudo gem install bundler
  2. Create a ./Gemfile in the root directory of your iOS / Android project with the following content
    source "https://rubygems.org"
    
    gem "fastlane"
  3. Run [sudo] bundle update and add both the ./Gemfile and the ./Gemfile.lock to version control.
  4. Every time you run Fastlane, use bundle exec fastlane [lane]
  5. On your CI (we will cover it later using Bitrise), add [sudo] bundle install as your build step before using Fastlane.
  6. To update Fastlane, just run [sudo] bundle update
Clone this wiki locally