Distribute CLI v2.1.0
Distribute CLI is a command-line tool to automate building and distributing Flutter applications for Android and iOS. It provides a unified workflow for building, publishing, and managing app distribution with a single YAML configuration file.
Features
- Build and distribute Flutter apps for Android and iOS
- Unified configuration with
distribution.yaml
- Supports Firebase App Distribution, Fastlane, and more
- Variable substitution for environment and custom variables
- Detailed logging to
distribution.log
- Customizable tasks and jobs for flexible workflows
Prerequisites
- Flutter
- Firebase CLI
- Fastlane
- macOS with Xcode (for iOS builds)
Installation
dart pub global activate distribute_cli
Getting Started
1. Initialize Your Project
distribute init --package-name=com.example.app
This command sets up the required directories and generates a starter distribution.yaml
.
2. Configure distribution.yaml
Edit the generated distribution.yaml
to define your build and publish tasks, jobs, and variables.
Example
name: "Distribution CLI"
description: "A CLI tool to build and publish your application."
variables:
ANDROID_PACKAGE: "com.example.app"
IOS_PACKAGE: "com.example.app"
APPLE_ID: "${{APPLE_ID}}"
APPLE_APP_SPECIFIC_PASSWORD: "${{APPLE_APP_SPECIFIC_PASSWORD}}"
tasks:
- name: "Android Build and deploy"
key: "android"
workflows:
- "build"
- "publish"
description: "Build and deploy the Android application to playstore."
jobs:
- name: "Build Android"
key: "build"
description: "Build the Android application using Gradle."
package_name: "${{ANDROID_PACKAGE}}"
builder:
android:
binary-type: "aab"
split-per-abi: false
build-mode: "release"
generate-debug-symbols: true
- name: "Publish Android"
key: "publish"
description: "Publish the Android application to playstore as internal test track."
package_name: "${{ANDROID_PACKAGE}}"
publisher:
fastlane:
file-path: "distribution/android/output"
binary-type: "aab"
track: "production"
metadata-path: "distribution/android/metadata"
track-promote-to: "production"
json-key: "distribution/fastlane.json"
skip-upload-images: true
skip-upload-screenshots: true
in-app-update-priority: 5
track-promote-release-status: "completed"
upload-debug-symbols: true
- name: "Android Build APKs and deploy"
key: "android_apk"
workflows:
- "build"
- "publish"
description: "Build and deploy the Android application to playstore."
jobs:
- name: "Build Android"
key: "build"
description: "Build the Android application using Gradle."
package_name: "${{ANDROID_PACKAGE}}"
builder:
android:
binary-type: "apk"
split-per-abi: true
build-mode: "release"
generate-debug-symbols: true
target-platform: "android-arm"
- name: "iOS Build and deploy"
key: "ios"
description: "Build and deploy the iOS application to app store."
jobs:
- name: "Build iOS"
key: "build"
description: "Build the iOS application using Xcode."
package_name: "${{IOS_PACKAGE}}"
builder:
ios:
binary-type: "ipa"
build-mode: "release"
pub: true
- name: "Publish iOS"
key: "publish"
description: "Publish the iOS application to app store."
package_name: "${{IOS_PACKAGE}}"
publisher:
xcrun:
file-path: "distribution/ios/output"
username: "${{APPLE_ID}}"
password: "${{APPLE_APP_SPECIFIC_PASSWORD}}"
binary-type: "ipa"
Commands Overview
The Distribute CLI provides several commands to manage your app distribution process.
distribute init
Initializes the project and creates a starter configuration.
Example
distribute init --package-name=com.example.app
distribute build <platform>
Builds the app for the specified platform (android
or ios
).
Example
distribute build android
distribute publish <publisher>
Publishes the built app using the specified publisher (e.g., firebase
, fastlane
).
Example
distribute publish fastlane
distribute run
Executes all tasks and jobs defined in distribution.yaml
.
Example
distribute run
distribute create
Creates new tasks or jobs in distribution.yaml
.
Example: Create a Task
distribute create task --name="My Task" --key=my_task --description="Description here"
Example: Create a Builder Job
distribute create job builder -t my_task -n "Build Android" -k build_android -P android
Example: Create a Publisher Job
distribute create job publisher -t my_task -n "Publish Android" -k publish_android -T fastlane
Variable Substitution
Use ${{KEY}}
in distribution.yaml
to reference environment variables or custom variables defined in the variables
section.
Logging
All logs are saved to distribution.log
in the project root for troubleshooting and auditing.
Contributing
Contributions are welcome! Please open issues or pull requests to help improve Distribute CLI.
License
MIT License. See the LICENSE file for details.
Libraries
- app_builder/android/arguments
- app_builder/android/command
- app_builder/build_arguments
- app_builder/custom/arguments
- app_builder/custom/command
- app_builder/ios/arguments
- app_builder/ios/command
- app_publisher/fastlane/arguments
- app_publisher/fastlane/command
- app_publisher/firebase/arguments
- app_publisher/firebase/command
- app_publisher/github/arguments
- app_publisher/github/command
- app_publisher/publisher_arguments
- app_publisher/xcrun/arguments
- app_publisher/xcrun/command
- builder_command
- command
- create_command
- files
- initializer_command
- logger
- parsers/config_parser
- parsers/job_arguments
- parsers/task_arguments
- publisher_command
- runner_command