Flutter ci cd
Skill almasumdev/awesome-flutter-agent-skills/.github/skills/build_and_tooling/flutter-ci-cd
Curated agent skills, conventions, and workflows for building Flutter apps with AI coding agents.
npx -y skills add almasumdev/awesome-flutter-agent-skills --skill flutter-ci-cdAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Setup CI/CD for Flutter — GitHub Actions, Codemagic, Fastlane, code signing, and automated Play Store / App Store releases. Use this when automating builds, tests, and releases.
SKILL.md
5.0 KB, as published. Nobody here has run it
CI/CD for Flutter
Instructions
A healthy Flutter project runs analyze + test on every PR, produces installable artifacts on main, and ships to the stores with one click (or automatically on a tag).
1. The Three Pipelines
- PR pipeline — fast feedback: format check,
flutter analyze,flutter test, optionally widget goldens. Target < 5 minutes. - Main pipeline — produces debug APK, iOS simulator build, integration tests on an emulator, coverage upload.
- Release pipeline — signs release builds, uploads to internal testing tracks, optionally promotes on approval.
2. GitHub Actions — PR Workflow
.github/workflows/pr.yml:
name: PR
on: { pull_request: { branches: [main] } }
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.0'
channel: stable
cache: true
- run: flutter pub get
- run: dart format --set-exit-if-changed .
- run: flutter analyze --fatal-infos
- run: dart run build_runner build --delete-conflicting-outputs
- run: flutter test --coverage
- uses: codecov/codecov-action@v4
with: { file: coverage/lcov.info }
3. Caching
- Cache
~/.pub-cache,~/.gradle/caches,~/Library/Caches/CocoaPods, and the Flutter SDK (thesubosito/flutter-actiondoes this withcache: true). - Cache by
pubspec.lockhash for Pub,Gemfile.lockfor Fastlane,Podfile.lockfor Pods.
4. Android Release Signing
- Generate
upload-keystore.jksonce; never commit it. - Base64-encode and store as a GitHub secret
ANDROID_KEYSTORE_BASE64, plusKEYSTORE_PASSWORD,KEY_ALIAS,KEY_PASSWORD. - In CI, decode into
android/upload-keystore.jksand writeandroid/key.propertiesat runtime. - In
android/app/build.gradle, read fromkey.propertiesfor thereleasesigningConfig. - Prefer Play App Signing — you only keep the upload key; Google manages the actual signing key.
5. iOS Release Signing
- Use match (fastlane) or App Store Connect API keys — never check in
.p12or provisioning profiles. - Store
APP_STORE_CONNECT_KEY_ID,APP_STORE_CONNECT_ISSUER_ID, and the base64.p8as secrets. fastlane match appstore --readonlyin CI fetches certs into a temporary keychain.
6. Fastlane Lanes
ios/fastlane/Fastfile:
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
setup_ci
match(type: "appstore", readonly: true)
build_app(workspace: "Runner.xcworkspace", scheme: "prod")
upload_to_testflight(skip_waiting_for_build_processing: true)
end
end
Android counterpart uses supply to upload an AAB to the internal track.
7. Release Workflow (Tag-Triggered)
on:
push:
tags: ['v*.*.*']
jobs:
android:
runs-on: ubuntu-latest
steps:
# decode keystore, flutter build appbundle --flavor prod -t lib/main_prod.dart
# fastlane supply --aab build/app/outputs/bundle/prodRelease/app-prod-release.aab --track internal
ios:
runs-on: macos-14
steps:
# flutter build ipa --flavor prod -t lib/main_prod.dart --export-options-plist=ios/ExportOptions.plist
# cd ios && bundle exec fastlane beta
Derive the version from the tag (v1.4.2 → buildName=1.4.2, buildNumber=$GITHUB_RUN_NUMBER) via flutter build ... --build-name=... --build-number=....
8. Codemagic / Bitrise (alternative)
If you want managed mac runners and a UI, Codemagic has first-class Flutter templates and handles signing end-to-end. Use when the team prefers not to maintain self-hosted macOS runners.
9. Web, Desktop, WASM
- Web:
flutter build web --wasm(Flutter 3.22+) and deploy to Firebase Hosting / Cloudflare Pages / GitHub Pages. - macOS: codesign + notarize via
codesign+xcrun notarytool submitin the pipeline. - Windows: build MSIX with
msixpackage; sign with EV cert in CI. - Linux: package as AppImage, Snap, or Flatpak.
10. Secrets Hygiene
- No secret in
--dart-definethat appears in logs (GitHub Actions masks known secrets, but mis-named env vars leak). - Rotate signing passwords yearly.
- Use environment protection rules on the release workflow (require manual approval).
- Strip debug symbols and obfuscate release builds:
--obfuscate --split-debug-info=build/symbols.
11. Checklist
- PR pipeline runs analyze + test < 5 min.
- Coverage uploaded and enforced (e.g., minimum 70%).
- Release pipeline signs and uploads to an internal track automatically on tags.
- Versioning derived from tags or monotonic CI number — never hand-edited.
- Dependabot / Renovate updates
pubspec.yaml, Gradle, Pods, and Actions weekly.