Fastlane Setup for iOS & Android
What you'll learn
- Configuring Fastlane lanes for iOS and Android builds
- Setting up flavor-specific build configurations
- Managing code signing with Match
- Running deployments from CI or locally
Prerequisites
- An existing Archipelago monorepo (see Monorepo Scaffolding)
- Xcode installed (for iOS builds)
- A Google Play Console and App Store Connect account
- Ruby and Bundler installed (
gem install bundler)
Step 1: Generate the Fastlane Configuration
bash
archipelago generate fastlaneYou will be prompted for:
- appName — Your app name (e.g.,
MyApp) - bundleId — Base bundle identifier (e.g.,
com.example.myapp) - flavors — Comma-separated list of flavors (e.g.,
dev,staging,production)
Step 2: Understand the Generated Structure
ios/fastlane/
├── Appfile # App Store Connect credentials
├── Fastfile # Lane definitions
├── Matchfile # Code signing config
└── Pluginfile # Fastlane plugins
android/fastlane/
├── Appfile # Play Console credentials
└── Fastfile # Lane definitionsStep 3: Configure Code Signing with Match
Match stores your certificates and profiles in a private Git repo, keeping your team in sync.
bash
# Initialize match (run once)
fastlane match initUpdate ios/fastlane/Matchfile with your credentials:
ruby
git_url("https://github.com/your-org/certificates")
storage_mode("git")
type("appstore")
app_identifier(["com.example.myapp"])Then sync certificates for each environment:
bash
fastlane match development
fastlane match appstoreStep 4: Run Flavor-Specific Builds
Each flavor maps to a separate lane. Build and deploy by specifying the flavor:
bash
# iOS — build staging IPA
cd ios && bundle exec fastlane build_staging
# Android — build production AAB
cd android && bundle exec fastlane build_productionThe generated Fastfile for iOS includes lanes like:
ruby
lane :build_production do
match(type: "appstore", app_identifier: "com.example.myapp")
build_app(
scheme: "production",
export_method: "app-store",
output_directory: "./build",
)
endStep 5: Deploy to Stores
Upload builds directly from Fastlane:
bash
# iOS — upload to TestFlight
cd ios && bundle exec fastlane deploy_staging
# Android — upload to Play Console internal track
cd android && bundle exec fastlane deploy_stagingKey Customization Points
| Customization | Where to Change |
|---|---|
| App Store Connect credentials | ios/fastlane/Appfile |
| Play Console credentials | android/fastlane/Appfile |
| Build schemes per flavor | ios/fastlane/Fastfile — lane definitions |
| Signing certificate repo | ios/fastlane/Matchfile — git_url |
| Build output directory | Fastfile — output_directory parameter |
Next Steps
- Set up GitHub Actions to run Fastlane lanes in CI
- Configure build_prepare to swap debug/release dependencies before building