R
Rishtaara
React Native Advanced: CI/CD Pipeline Mastery
Lesson 15 of 19Article20 min

Fastlane Setup

Fastlane is a Ruby-based tool with 'lanes' — scripts that chain build, sign, test, and upload steps. It runs locally and in CI identically. One Fastfile per platform (android/, ios/) keeps concerns separated.

Fastlane — the mobile release automation layer

Fastlane is a Ruby-based tool with 'lanes' — scripts that chain build, sign, test, and upload steps. It runs locally and in CI identically. One Fastfile per platform (android/, ios/) keeps concerns separated.

Fastlane release flow

Project setup

Install Fastlane
# macOS (recommended for iOS lanes)
brew install fastlane
# Project-local Gemfile approach (CI-friendly)
cd android && fastlane init
cd ios && fastlane init
# Commit Gemfile.lock for reproducible CI builds
android/fastlane/Fastfile
default_platform(:android)

platform :android do
  desc "Deploy to Play Internal testing"
  lane :internal do
    increment_version_code(app_project_dir: "app")
    gradle(task: "bundle", build_type: "Release")
    upload_to_play_store(
      track: "internal",
      aab: "app/build/outputs/bundle/release/app-release.aab",
      json_key: ENV["PLAY_STORE_JSON_KEY_PATH"],
      skip_upload_metadata: true,
      skip_upload_images: true,
      skip_upload_screenshots: true
    )
  end
end
ios/fastlane/Fastfile + Match for signing
default_platform(:ios)

platform :ios do
  desc "Push to TestFlight"
  lane :beta do
    setup_ci if ENV["CI"]
    match(type: "appstore", readonly: true)  # sync certs from git or cloud
    increment_build_number(xcodeproj: "MyApp.xcodeproj")
    build_app(workspace: "MyApp.xcworkspace", scheme: "MyApp", export_method: "app-store")
    upload_to_testflight(skip_waiting_for_build_processing: true)
  end
end

Common Fastlane actions

  • match — sync code signing certs and profiles across team via encrypted git repo.
  • gradle / build_app — compile release binaries.
  • upload_to_play_store / upload_to_testflight — store uploads.
  • snapshot — automated App Store screenshots across device sizes.
  • slack / discord — post lane success/failure from Fastfile directly.