Wednesday, February 11, 2026
HomeFlutterHow to use CI/CD in Flutter

How to use CI/CD in Flutter

Below is a clear, practical guide to using CI/CD in Flutter, with real-world examples that work for Android, iOS, and web apps.


What is CI/CD in Flutter?

CI (Continuous Integration) automatically:

  • Fetches your Flutter code
  • Installs dependencies
  • Runs tests & static analysis
  • Builds the app

CD (Continuous Deployment) automatically:

  • Generates APK/AAB/IPA/Web builds
  • Uploads builds to Play Store / TestFlight / Firebase / servers

Popular CI/CD Tools for Flutter

ToolBest For
GitHub ActionsFree, easy, most popular
GitLab CIEnterprise projects
BitriseMobile-focused CI/CD
CodemagicFlutter-first CI/CD
JenkinsSelf-hosted CI/CD

👉 Recommended: GitHub Actions (free & flexible)


Basic Flutter CI/CD Flow

  1. Push code to GitHub
  2. CI runs automatically
  3. Flutter checks & builds
  4. Artifacts are generated
  5. CD uploads build

Step 1: Prepare Flutter Project

Make sure your project works locally:

flutter doctor
flutter test
flutter build apk

Step 2: GitHub Actions Setup

Create this file:

📁 .github/workflows/flutter_ci.yml

name: Flutter CI/CD

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: subosito/flutter-action@v2
        with:
          flutter-version: 'stable'

      - name: Install dependencies
        run: flutter pub get

      - name: Analyze code
        run: flutter analyze

      - name: Run tests
        run: flutter test

      - name: Build APK
        run: flutter build apk

✅ Automatically runs on every push


Step 3: Generate Release Builds

Android AAB (Play Store)

- name: Build App Bundle
  run: flutter build appbundle

Web

- name: Build Web
  run: flutter build web

Step 4: Upload Build Artifacts

- uses: actions/upload-artifact@v4
  with:
    name: flutter-build
    path: build/

Step 5: Android Signing (Important)

  1. Create keystore
keytool -genkey -v -keystore keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  1. Add secrets in GitHub:
  • KEYSTORE_BASE64
  • KEYSTORE_PASSWORD
  • KEY_ALIAS
  • KEY_PASSWORD
  1. Decode keystore in CI:
- name: Decode keystore
  run: |
    echo "$KEYSTORE_BASE64" | base64 --decode > android/app/keystore.jks

Step 6: Firebase App Distribution (Optional)

- name: Upload to Firebase
  run: |
    npm install -g firebase-tools
    firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk \
      --app $FIREBASE_APP_ID \
      --token $FIREBASE_TOKEN

Step 7: iOS CI/CD (Mac Required)

runs-on: macos-latest

Build:

flutter build ipa

⚠️ Requires:

  • Apple Developer account
  • Certificates & provisioning profiles

Best Practices for Flutter CI/CD

✔ Use separate workflows for dev & prod
✔ Run flutter analyze + test before build
✔ Never commit keystore or credentials
✔ Use environment-based builds
✔ Cache Flutter packages for faster builds


Recommended CI/CD for Flutter (Beginner → Pro)

  • Beginner: GitHub Actions
  • Intermediate: Codemagic
  • Enterprise: Bitrise + Fastlane

Flutter CI/CD Architecture Diagram

Git Push → CI (Tests) → Build → Artifact → Store / Firebase

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments