"Don't Script It, Fastlane It"
Fastlane is an open-source Ruby-based toolkit that automates the most painful parts of iOS and Android release pipelines. Before Fastlane, teams wrote fragile shell scripts that called xcodebuild with dozens of flags, manually managed certificates, and hand-uploaded builds to TestFlight. Fastlane replaces all of this with a declarative configuration file called a Fastfile.
A Fastfile defines lanes — named sequences of actions. Each action is a pre-built Ruby function that wraps a complex operation. Here is a minimal example:
# fastlane/Fastfile
default_platform(:ios)
platform :ios do
lane :beta do
match(type: "appstore") # Sync certificates and profiles
increment_build_number # Bump the build number
gym(scheme: "MyApp") # Build and sign the .ipa
pilot(skip_waiting_for_build_processing: true) # Upload to TestFlight
end
end
Running fastlane beta from the command line (or from a CI pipeline) executes all four steps in sequence. If any step fails, Fastlane stops and reports the error clearly.
The Killer Feature: fastlane match
fastlane match implements a specific philosophy: one certificate per team, stored encrypted in a private Git repository, shared by everyone including CI.
Here is how it works:
Setup (done once by a team lead): initializing match creates the private cert repo, then separate commands generate and store the App Store distribution certificate and the development certificate. Match generates new certificates, encrypts them with a passphrase using OpenSSL, and pushes them to a private Git repository you control (e.g., github.com/myorg/ios-certificates).
On every CI build: the CI runner fetches and installs the certificates in read-only mode. The --readonly flag prevents CI from accidentally regenerating certificates. Match fetches the encrypted files from the Git repo, decrypts them using the MATCH_PASSWORD environment variable (stored as a CI secret), and installs the certificate into the macOS Keychain and the provisioning profile into the correct system directory. The build proceeds as if a developer had manually set everything up.
The result: Every developer and every CI runner uses the same certificate. When it expires, one person runs fastlane match nuke && fastlane match appstore to regenerate it, and everyone gets the update automatically on their next match run.
Other Essential Fastlane Actions
| Action | Purpose |
|---|---|
gym |
Builds and signs the .ipa using xcodebuild under the hood |
scan |
Runs your test suite and generates JUnit XML reports for CI |
pilot |
Uploads builds to Apple TestFlight |
deliver |
Submits to the App Store with metadata and screenshots |
supply |
Uploads Android builds to Google Play |
increment_build_number |
Bumps the CFBundleVersion before each build |
slack |
Posts build status notifications to a Slack channel |
A common interview question is: "How do you handle certificate rotation in a mobile CI pipeline?" Weak answers describe manual processes. Strong answers describe fastlane match: certificates live in an encrypted Git repo, rotation is a single command, and CI uses --readonly mode so it never modifies the source of truth. Follow up by mentioning that the MATCH_PASSWORD is stored as a CI secret (never in the repo) and that access to the certificate repo is restricted to senior engineers.