Flutter CI/CD Using GitHub Actions — Android & Web Deployment from Zero to Release
Teqani Blogs
Writer at Teqani
In today’s fast-paced tech environment, continuous integration and continuous delivery (CI/CD) are essential for shipping software efficiently. This article provides a comprehensive guide to setting up a CI/CD pipeline for Flutter applications using GitHub Actions, covering Android and Web deployments.
Initial Project Setup
Start by creating a new Flutter project and initializing Git:
flutter create my_project
cd my_project
git init
git remote add origin https://github.com/your-user/flutter-cicd.git
git push -u origin master
mkdir -p .github/workflows
Android Build Workflow
Create an Android release workflow file .github/workflows/android-release.yml
:
name: Android Release
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '12.x'
cache: 'gradle'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.0'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Build AAB
run: flutter build appbundle
Optimize build time by caching Gradle dependencies. This improves build performance.
Android App Signing (Secure)
Securely sign your Android app by generating a keystore and storing it as a GitHub secret:
- Generate keystore:
keytool -genkey -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
- Encode keystore:
base64 upload-keystore.jks > keystore.txt
- Add secrets to GitHub:
KEYSTORE_BASE64
,STORE_PASSWORD
,KEY_PASSWORD
,KEY_ALIAS
Decode the keystore in your workflow:
- name: Decode keystore
id: android_keystore
uses: timheuer/base64-to-file@v1.0.3
with:
fileName: upload-keystore.jks
encodedString: $
Deploy to Google Play (Alpha/Internal)
Configure a service account in Google Cloud and enable the Google Play Developer API. Add the JSON key as a secret PLAYSTORE_ACCOUNT_KEY
.
- name: Release to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: $
packageName: com.example.app
releaseFiles: app-release.aab
track: alpha
status: completed
Deploy Flutter Web to GitHub Pages
Create a web release workflow file .github/workflows/web-release.yml
:
name: Web Release
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.0.0"
channel: 'stable'
cache: true
- run: flutter pub get
- run: flutter build web --release
- uses: actions/upload-artifact@v2
with:
name: web-release
path: build/web
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: web-release
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: $
publish_dir: ./build/web
Set your repository to serve GitHub Pages from the gh-pages
branch.
README.md Badge Integration
Integrate badges into your README.md to showcase your CI/CD status:


This article provides a foundational understanding of automating Flutter deployments using GitHub Actions. Automating your CI/CD process improves development velocity and ensures consistent releases.
All blogs are certified by our company and reviewed by our specialists
Issue Number: #f1f2f2c2-1ace-4208-90c8-c8b1f48bef0b