Implementing CI/CD for Flutter apps Using GitHub Actions
Automating Flutter app build, test & release with GitHub Actions

AI Engineer
Search for a command to run...
Automating Flutter app build, test & release with GitHub Actions

AI Engineer
No comments yet. Be the first to comment.
Spec-Driven Development (SDD) is the idea of beginning every AI-assisted project with clearly defined requirements, not jumping right into code. This companion piece takes that idea from theory to practice. Here, we’ll walk through the complete workf...

Intent to Implementation Deviation and Context Engineering

Start with Context Engineering before you blame the AI model

In the age of personal branding, Twitter (now X) is a goldmine for audience building. But staying consistent with high-quality, niche-specific tweets is hard—unless you automate it. This guide introduces a fully automated tweet generation and posting...

Cost optimization is crucial for maintaining efficient and affordable cloud infrastructure in the ever-evolving cloud landscape. AWS provides numerous services and tools to help manage and optimize costs. One effective cost-saving measure is identify...

Continuous Integration and Continuous Deployment (CI/CD) is a crucial part of the software development process. It helps automate the build, testing, and deployment of your application, ensuring that code changes are integrated and deployed smoothly. In this blog post, I'll walk you through setting up CI/CD for a Flutter application using GitHub Actions.
Before you start, ensure that you have the following prerequisites in place:
A Flutter project hosted on GitHub.
Flutter installed on your development machine.
A basic understanding of GitHub Actions.
GitHub Actions uses YAML files to define workflows. In this example, we've defined a workflow named "Build & Release" that runs when pull requests are created or pushed to the main, master, or develop branches.
on:
pull_request:
branches:
- main
- master
push:
branches:
- main
- master
- develop
name: "Build & Release"
This workflow is triggered both on pull requests and direct pushes to specific branches.
A sample of the workflow is shown below which basically performs all the continuous integration(CI) part.
on:
pull_request:
branches:
- main
- master
push:
branches:
- main
- master
- develop
name: "Build & Release"
jobs:
build:
name: Build & Release
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.13.9'
- run: flutter pub get
- run: flutter test
- run: flutter build apk --debug --split-per-abi
- run: |
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app.ipa Payload
- name: Push to Releases
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/debug/*,build/ios/iphoneos/app.ipa"
tag: v1.0.${{ github.run_number }}
token: ${{ secrets.TOKEN }}
Let's break down the individual steps in our CI/CD workflow:
Check Out the Code
The actions/checkout action is used to clone your repository into the runner's workspace.
jobs:
build:
steps:
- uses: actions/checkout@v1
Set up Java
- uses: actions/setup-java@v1
with:
java-version: '12.x'
Set up Flutter
Next, we use the subosito/flutter-action action to install the specified Flutter version.
- uses: subosito/flutter-action@v1
with:
flutter-version: '3.13.9'
Get Dependencies & Run Tests
Use the following steps to fetch dependencies and run tests:
- run: flutter pub get
- run: flutter test
Build the Android APK
Build the Android APK for your Flutter application in debug mode:
- run: flutter build apk --debug --split-per-abi
Build the iOS IPA
For iOS, we generate IPA as following:
- run: |
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app.ipa Payload
Push the artifacts to GitHub releases
Finally, we use the ncipollo/release-action action to package the built artifacts (APK and IPA) and create a GitHub release. It will also tag the release with a version number.
- name: Push to Releases
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/debug/*,build/ios/iphoneos/app.ipa"
tag: v1.0.${{ github.run_number }}
token: ${{ secrets.TOKEN }}
The TOKEN secret should be set up in your repository's settings with appropriate permissions to create releases.

We can view the pipeline in the actions tab of the GitHub repo. After successful completion, it should look something as shown above. And, the release section becomes:

And when you click on the particular release, you get to the artifacts.

This is how the CI/CD pipeline is implemented for Flutter app using GitHub actions.
This article mainly focused on the Continuous Integration(CI) part, the Continuous Delivery(CD) part can be implemented using Fastlane for Appstore and Playstore, which will be discussed in future articles.