Last updated: November 13, 2026
Repeated manual checks are easy to miss and difficult to reproduce. In this codelab, you will set up a CI/CD pipeline that consistently runs Flutter checks, tests, and builds with GitHub Actions.
Continuous integration (CI) runs automated checks when changes are proposed or pushed. Continuous delivery/deployment (CD) automates release preparation or delivery. A good pipeline makes important steps repeatable and its results reviewable.
Use pull_request to check changes before merging and push to check the main branch. Grant only the minimum permissions required. Pull requests from forks do not receive repository GitHub Secrets.
At the project root, create .github/workflows/flutter-ci.yml. Change the branch name if your default branch is not main.
name: Flutter CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter pub get
- run: dart format --output=none --set-exit-if-changed .
- run: flutter analyze --fatal-infos
- run: flutter test --coverage
Before pushing, run the same formatting, analysis, and test commands on your project. Fix failures; do not remove checks just to make the workflow green.
After the tests pass, add these steps to the same job:
- run: flutter build apk --release
- run: flutter build appbundle --release
- uses: actions/upload-artifact@v4
with:
name: android-builds
path: |
build/app/outputs/flutter-apk/app-release.apk
build/app/outputs/bundle/release/app-release.aab
if-no-files-found: error
retention-days: 7
In pubspec.yaml, a version such as 1.2.0+15 means app version 1.2.0 and build number 15. Follow semantic versioning: major for incompatible changes, minor for compatible features, and patch for fixes. Increment the build number for each new upload.
Use a tag such as v1.2.0 to connect source, pipeline logs, and artifacts. Make sure the tag points to a commit that passed the checks.
--dart-define can be extracted from a client app.For signed releases, follow Flutter's official signing guide and inject sensitive material only into a restricted release workflow. Do not expose a production keystore to pull-request workflows.