distribute_cli 1.0.0
distribute_cli: ^1.0.0 copied to clipboard
Quick way to distribute your app to playstore and appstore
Distribute CLI #
distribute_cli is a command-line utility designed to streamline the process of building and distributing your Flutter applications.
Installation #
To install distribute_cli, please follow these steps:
- Activate the CLI
Execute the following command to globally activatedistribute_cli:dart pub global activate distribute_cli
Prerequisites #
Ensure the following tools are installed before proceeding:
-
Fastlane (for Android distribution):
Follow the installation guide available at fastlane.tools. -
Firebase CLI (optional, for Firebase App Distribution):
Install Firebase CLI by running:npm install -g firebase-tools -
Xcode Command Line Tools (for iOS builds):
Install Xcode and verify thatxcrunis accessible. -
Git:
Ensure Git is installed and configured for generating changelogs. -
Google Cloud Service Account Key (for Fastlane):
Obtain the JSON key file for your Google Cloud service account. This is required for Fastlane to upload Android builds to the Play Store.
Environment Configuration #
When you run distribute init, a .distribution.env file will be automatically generated with the following structure:
# Android Configuration
ANDROID_BUILD=true
ANDROID_DISTRIBUTE=true
ANDROID_PACKAGE_NAME=
ANDROID_FIREBASE_APP_ID=
ANDROID_FIREBASE_GROUPS=
# iOS Configuration
IOS_BUILD=true
IOS_DISTRIBUTE=true
IOS_DISTRIBUTION_USER=
IOS_DISTRIBUTION_PASSWORD=
# Distribution Options
USE_FASTLANE=true
USE_FIREBASE=false
Additionally, a distribution directory will be created.
It is recommended to add both .distribution.env and the distribution directory to your .gitignore file to prevent committing sensitive information:
.distribution.env
distribution/
Populating the .distribution.env File #
-
ANDROID_BUILD:
Set totrueto enable Android builds. -
ANDROID_DISTRIBUTE:
Set totrueto enable Android distribution after building. -
ANDROID_PACKAGE_NAME:
Specify your app's package name (e.g.,com.example.app). -
ANDROID_FIREBASE_APP_ID:
Provide your Firebase App ID if using Firebase App Distribution. Leave blank otherwise. -
ANDROID_FIREBASE_GROUPS:
List Firebase tester groups (comma-separated) for distribution. Leave blank if not applicable. -
IOS_BUILD:
Set totrueto enable iOS builds. -
IOS_DISTRIBUTE:
Set totrueto enable iOS distribution after building. -
IOS_DISTRIBUTION_USER:
Provide your Apple ID for App Store distribution. -
IOS_DISTRIBUTION_PASSWORD:
Provide your app-specific password for App Store distribution. You can generate it from Apple ID settings. -
USE_FASTLANE:
Set totrueto enable Fastlane for Android distribution. -
USE_FIREBASE:
Set totrueto enable Firebase App Distribution.
Adding the distribution/fastlane.json File #
- Visit the Google Cloud Console.
- Navigate to IAM & Admin > Service Accounts.
- Select or create a service account with Editor or Release Manager permissions for your Play Store project.
- Generate a JSON key for the service account and download it.
- Place the JSON key file in the
distributiondirectory and name itfastlane.json.
Ensure your project directory is structured as follows:
your_project_directory
├── lib
├── distribution
├── fastlane.json
Usage Instructions #
-
Install the CLI
Run the following command to globally installdistribute_cli:dart pub global activate distribute_cli -
Initialize Distribution
Execute this command in your project directory to set up the distribution environment:dart run distribute init -
Build Your Project
Use the following command to build your project. Include the-pflag to automatically upload the build:dart run distribute build -p -
Publish Your Project
To publish your project without building, run:dart run distribute publish
For additional arguments and details, refer to the sections below.
Command Reference #
Run commands to build and distribute your app packages:
distribute <command> [arguments]
Global Options #
-
-h, --help
Display usage information. -
--config_path
Specify the path to the configuration file.
(defaults to.distribution.env) -
-v, --[no-]verbose
Enable verbose output. -
-l, --[no-]process_logs
Enable process logs.
Available Commands #
init
Initialize the distribution tool:
distribute init
build
Build the application:
distribute build [arguments]
Options:
-
-p, --[no-]publish
Automatically distribute Android builds. -
--[no]-android
Build Android.
(enabled by default) -
--[no]-ios
Build iOS.
(enabled by default) -
--android_args
Specify additional arguments for Android builds.
(defaults to"") -
--ios_args
Specify additional arguments for iOS builds.
(defaults to"") -
--custom_args=<macos:macos,windows:windows,ios:ipa,android_apk:apk>
Provide custom arguments in the formatkey:args,key:args. These will be executed asflutter build <args>.
(defaults to"")
publish
Distribute the application:
distribute publish [arguments]
Options:
-
--[no-]android
Build and distribute Android.
(enabled by default) -
--[no-]ios
Build and distribute iOS.
(enabled by default) -
--[no-]firebase
Use Firebase for distribution. -
--[no-]fastlane
Use Fastlane for distribution.
(enabled by default)
License #
This project is licensed under the MIT License. For more details, refer to the LICENSE file.