Skip to content

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 fastlane

You 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 definitions

Step 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 init

Update 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 appstore

Step 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_production

The 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",
  )
end

Step 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_staging

Key Customization Points

CustomizationWhere to Change
App Store Connect credentialsios/fastlane/Appfile
Play Console credentialsandroid/fastlane/Appfile
Build schemes per flavorios/fastlane/Fastfile — lane definitions
Signing certificate repoios/fastlane/Matchfilegit_url
Build output directoryFastfileoutput_directory parameter

Next Steps

Built by Banua Coder