Flutter CI/CD with Fastlane: Automate Play Store Deployment

Learn how to automate Flutter app deployment to Google Play Store using Fastlane. Complete CI/CD guide with signing, versioning, and release automation.

Introduction

Building your Flutter app is one thing — but uploading it manually to the Play Store every time is slow and inefficient.

Fastlane allows you to automate your entire release process:

  • Build app automatically
  • Increment version
  • Upload to Play Store
  • Distribute to testers

In this guide, we will set up Fastlane for Flutter Android deployment.

What is Fastlane?

Fastlane is an open-source automation tool for mobile app deployment.

Flutter App → Fastlane → Play Store

Why Use Fastlane?

  • No manual Play Store uploads
  • Consistent release process
  • Save time
  • Reduce human errors

Step 1: Install Fastlane

brew install fastlane

or

sudo gem install fastlane

Step 2: Initialize Fastlane

Inside your Flutter project:

cd android
fastlane init

Choose:

  • Upload to Google Play

Step 3: Configure Play Store API

Go to Google Play Console:

  • Create Service Account
  • Download JSON key
  • Give release permissions

Place JSON file in:

android/fastlane/service_account.json

Step 4: Configure Fastfile

default_platform(:android)

platform :android do

  desc "Deploy to Play Store"
  lane :deploy do

    sh "flutter build appbundle --release"

    upload_to_play_store(
      track: 'internal',
      aab: '../build/app/outputs/bundle/release/app-release.aab',
      json_key: 'fastlane/service_account.json'
    )

  end

end

Step 5: Run Deployment

fastlane deploy

This will:

  • Build AAB
  • Upload to Play Store
  • Release to internal testing

Automatic Version Increment

lane :deploy do

  increment_version_code(
    gradle_file_path: "app/build.gradle"
  )

  sh "flutter build appbundle --release"

  upload_to_play_store(...)

end

CI/CD Integration (GitHub Actions)

- name: Run Fastlane
  run: |
    cd android
    fastlane deploy

Handling Secrets Securely

  • Do not commit service_account.json
  • Use GitHub Secrets

Firebase App Distribution (Optional)

firebase_app_distribution(
  app: "APP_ID",
  testers: "test@example.com",
  apk_path: "app-release.apk"
)

Release Tracks

  • internal
  • alpha
  • beta
  • production

Production Deployment

track: 'production'

Best Practices

  • Use internal testing first
  • Automate versioning
  • Keep release notes updated
  • Use separate lanes for staging & production

Common Mistakes

  • Wrong JSON permissions
  • Missing AAB path
  • Not incrementing version

Advanced Setup

  • Multiple flavors (dev/staging/prod)
  • Slack notifications
  • Automated changelog

Full Deployment Flow

Push Code
   ↓
GitHub Actions
   ↓
Run Fastlane
   ↓
Build AAB
   ↓
Upload to Play Store
   ↓
Release to testers

Conclusion

Fastlane transforms your Flutter deployment process into a fully automated pipeline.

Once configured, you can deploy your app with a single command or even automatically on every commit.

This is how professional teams ship apps at scale.

Share

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0