Skip to content

πŸš€ GitHub CLI Extension: One-command Flutter CI/CD setup with GitHub Actions, Fastlane, and self-hosted runners

License

Notifications You must be signed in to change notification settings

mbilalbenli/gh-flutter-cicd-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flutter CI/CD Bootstrap

πŸš€ One-command setup for Flutter CI/CD with GitHub Actions, Fastlane, and self-hosted runners

What This Tool Does

βœ… Copies all CI/CD files from a proven, production-ready setup
βœ… Generates custom setup guide with your app's specific configuration
βœ… No automatic modifications - you control every change
βœ… Safety checks to prevent data loss
βœ… Comprehensive instructions for Android, iOS, secrets, and deployment

Features

  • πŸ“± Complete CI/CD Pipeline: GitHub Actions workflow with quality checks, builds, and deployments
  • πŸš€ Fastlane Integration: iOS TestFlight and Android Play Store automation
  • πŸͺ Smart Git Hooks: Automatic version conflict resolution
  • πŸ›‘οΈ Security Controls: Deployment whitelist and commit prefix system
  • πŸ“‹ Detailed Instructions: Step-by-step guide customized for your app
  • πŸ”§ Self-hosted Runner: Optimized for macOS build environments

Installation

Option 1: GitHub CLI Extension (Recommended)

# Install as GitHub CLI extension
gh extension install mbilalbenli/flutter-cicd-bootstrap
gh flutter-cicd init

Option 2: NPM Global Install

npm install -g flutter-cicd-bootstrap
flutter-cicd-bootstrap init

Option 3: Direct Download

git clone https://github.com/mbilalbenli/flutter-cicd-bootstrap.git
cd flutter-cicd-bootstrap
npm install
node bin/gh-flutter-cicd

Quick Start

cd your-flutter-project
gh flutter-cicd init

# Follow interactive prompts
# Read generated FLUTTER_CICD_SETUP.md
# Configure Android/iOS as instructed
# Set up GitHub secrets
# Test with: git commit -m "deploy: test setup"

What Gets Copied

GitHub Actions

  • .github/workflows/mobile-ci.yml - Main CI/CD pipeline
  • .github/actions/setup-flutter/ - Flutter setup action
  • .github/actions/setup-ruby-fastlane/ - Ruby/Fastlane setup action

Fastlane Configuration

  • fastlane/Fastfile - Build and deployment lanes
  • fastlane/Appfile - App identifiers and credentials
  • fastlane/Matchfile - iOS certificate management

Git Hooks

  • .githooks/pre-commit - Version conflict prevention

Templates

  • android/key.properties.example - Android signing template

Documentation

  • FLUTTER_CICD_SETUP.md - Your custom setup guide

Safety Features

  • βœ… Pre-flight checks - Validates Flutter project and git status
  • βœ… Conflict detection - Warns about files that will be overwritten
  • βœ… No modifications - Only copies files, never modifies existing code
  • βœ… Validation - Checks bundle ID format and required inputs
  • βœ… Comprehensive warnings - Alerts about uncommitted changes and conflicts

CI/CD Pipeline Features

Deployment Control

Commit Prefix Behavior
deploy: message Force deploy from any branch (if whitelisted)
nodeploy: message Skip all CI/CD workflows
v1.2.3: message Set specific version and deploy
[skip ci] Skip CI/CD (standard GitHub convention)

Version Management

  • Automatic versioning on main/dev branches
  • Version conflict prevention with git hooks
  • Manual version override with commit prefixes
  • Build number formula: major*100 + minor*10 + patch

Platform Support

  • iOS: Xcode builds β†’ TestFlight deployment
  • Android: Gradle builds β†’ Play Store deployment
  • Environment-based: Different secrets per branch
  • Quality gates: Formatting, analysis, tests (configurable)

Requirements

Development Environment

  • Flutter SDK β‰₯3.32.8
  • Git with repository access
  • GitHub CLI (optional, for easier secrets management)

Self-hosted Runner

  • macOS (required for iOS builds)
  • Xcode (for iOS)
  • Android SDK (for Android)
  • Ruby β‰₯3.0 + Bundler + Fastlane
  • Flutter SDK configured

External Services

  • GitHub repository with Actions enabled
  • Apple Developer Account (for iOS)
  • Google Play Console (for Android)
  • Certificate repository (private Git repo for iOS certificates)

Generated Setup Guide

After running the tool, you'll get a comprehensive FLUTTER_CICD_SETUP.md with:

  1. Your specific configuration (bundle ID, app name, etc.)
  2. Android setup steps (Gradle, manifest, package structure)
  3. iOS setup steps (Xcode, Info.plist, Fastlane)
  4. GitHub secrets configuration (with exact secret names)
  5. Self-hosted runner verification
  6. Testing instructions
  7. Troubleshooting guide

Example Usage

$ gh flutter-cicd init

πŸš€ Flutter CI/CD Bootstrap

? App name (displayed to users): My Awesome App
? Bundle ID (com.company.app): com.mycompany.awesomeapp
? GitHub repository (username/repo): myuser/awesome-app
? Main branch name: main
? Development branch name: dev
? Self-hosted runner labels: self-hosted,macOS,awesome-runner
? Include Android configuration? Yes
? Include iOS configuration? Yes

πŸ“‹ Configuration Summary:
App Name: My Awesome App
Bundle ID: com.mycompany.awesomeapp
GitHub Repo: myuser/awesome-app
Branches: main / dev
Runner Labels: self-hosted,macOS,awesome-runner
Android: βœ…
iOS: βœ…

? Proceed with file copying? Yes

πŸ“ Copying CI/CD files...
  πŸ“„ Copying GitHub Actions workflow...
  πŸš€ Copying GitHub Actions...
  πŸ“± Copying Fastlane configuration...
  πŸͺ Copying git hooks...
  πŸ€– Copying Android templates...

πŸ“ Generating your custom setup guide...
  πŸ“ Generated: FLUTTER_CICD_SETUP.md

πŸŽ‰ Setup completed successfully!

πŸ“‹ Next steps:
  1. Read your custom setup guide: FLUTTER_CICD_SETUP.md
  2. Review all copied files before committing
  3. Follow the Android/iOS configuration steps
  4. Set up GitHub secrets and variables
  5. Test your first deployment with: git commit -m "deploy: test setup"

⚠️  Important: Review all files before committing to git!

Troubleshooting

Common Issues

"Not a Flutter project"

  • Ensure you're in a directory with pubspec.yaml
  • Run flutter create . if needed

"Files will be overwritten"

  • Review the warning list
  • Backup important files manually
  • The tool shows exactly which files will be affected

"Flutter CLI not found"

"GitHub CLI not found"

Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m "Add amazing feature"
  4. Push branch: git push origin feature/amazing-feature
  5. Open Pull Request

License

MIT License - see LICENSE file for details

Credits

Based on production CI/CD setup from giderx - a Flutter expense tracking app with automated deployment to iOS TestFlight and Android Play Store.


Made with ❀️ for the Flutter community

About

πŸš€ GitHub CLI Extension: One-command Flutter CI/CD setup with GitHub Actions, Fastlane, and self-hosted runners

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •