flutter_release 0.3.2 copy "flutter_release: ^0.3.2" to clipboard
flutter_release: ^0.3.2 copied to clipboard

A tool for building and publishing Flutter apps, e.g. on GitHub, the Google Play Store and Apple's App Store.

flutter_release #

A tool for building and publishing Flutter apps, e.g. on GitHub, the Google Play Store and Apple's App Store. See also the according GitHub action.

Example #

Build:

flutter_release build apk \
 --app-name example \ # Using name in pubspec by default
 --app-version v0.0.1-alpha.1 \ # Using version in pubspec by default
 --build-arg=--dart-define=API_URL=https://example.com \
 --build-arg=--dart-define=API_KEY=12345678

Publish:

flutter_release publish android-google-play \
 --dry-run \
 --stage internal \
 --app-name example \
 --app-version v0.0.1-alpha.1 \
 --build-arg=--dart-define=API_URL=https://example.com \
 --build-arg=--dart-define=API_KEY=12345678 \
 --fastlane-secrets-json-base64=$(base64 --wrap=0 android/fastlane-secrets.json) \
 --keystore-file-base64=$(base64 --wrap=0 android/keystore.jks) \
 --keystore-password=<mykeystorepassword> \
 --key-alias=<mykeyalias> \
 --key-password=<mykeypassword>

If the command is not found (in the PATH), try: dart pub global run flutter_release ....

Note that you have to pass the base64 arguments without any newline characters:

MY_BASE_64=$(base64 --wrap=0 /myfile)

Or remove them afterward:

MY_BASE_64="${MY_BASE_64//$'\n'/}"

Options: #

  • app-name: The name of the app executable
  • app-version: Semantic version of the release (like v1.2.3), see https://semver.org/
  • build-metadata: Specify the build number (also used as version code for Android, but is handled automatically)
  • build-type: Release one of the following options: apk, web, ipk, macos, windows, debian
  • build-arg: Add options such as --dart-define to the flutter build command

Supported Features #

Platform Android iOS web Windows macOS Linux
Build apk ✓ aab ✓ ipa ❌ web ✓ windows ✓ macos ✓ linux ✓ debian ✓
Publish Google Play ✓ iOS App Store ✓ Web Server ✓ Microsoft Store ❌ Mac App Store ❌ Snap ❌ Ubuntu ❌

Support for other app distributors is planned.

Setup #

Android - Google Play Store (via Debian only) #

  1. Create an App in your Google Play Console.
  2. Make sure you have these files ignored in your ./android/.gitignore:
    key.properties
    **/*.keystore
    **/*.jks
    
    # Google Play Store credentials
    fastlane-*.json
    play-store-credentials.json
    
  3. Configure signing in gradle. This is needed to be able to execute the build via Flutter and not via Gradle. Convert the keystore to a base64 string e.g. base64 --wrap=0 android/keystore.jks
  4. Follow the guide of fastlane for setting up supply. No need to add the path to the Fastlane AppFile (as it should not exist at this point).
  5. Convert the Google Play Store credentials json (downloaded from cloud.google.com) to base64 e.g. base64 --wrap=0 android/fastlane-secrets.json
  6. Manually build a signed app bundle and publish it on the Google Play Store at least once to be able to automate the process, e.g.:
    flutter build appbundle \
     --release
    
  7. Run flutter_release
    flutter_release publish android-google-play \
     --dry-run \
     --stage internal \
     --fastlane-secrets-json-base64=$(base64 --wrap=0 android/fastlane-secrets.json) \
     --keystore-file-base64=$(base64 --wrap=0 android/keystore.jks) \
     --keystore-password=<mykeystorepassword> \
     --key-alias=<mykeyalias> \
     --key-password=<mykeypassword>
    
    For flavor support add:
     --flavor=prod \
     --main-path lib/main_prod.dart # Using "lib/main.dart" by default
    

iOS - App Store #

  1. Make sure you have these files ignored in your ./ios/.gitignore:
    *.cer
    *.certSigningRequest
    *.mobileprovision
    *.p12
    *.p8
    
  2. Create an App Store connect API Team key with App Manager permissions. Copy the key into your ios folder. Also copy the Key ID and the Issuer ID for later.
  3. Execute flutter_release prepare ios. Follow the steps. To delete existing certificates, visit: https://developer.apple.com/account/resources/certificates/list
  4. Make sure the certificate is selected in the App Store provisioning profile
  5. Extract the information from the ios/fastlane/Appfile file.
  6. Run flutter_release
    flutter_release publish ios-app-store \
     --dry-run \
     --apple-username=<apple_id> \
     --api-key-id=<api-key-id> \
     --api-issuer-id=<api-issuer-id> \
     --api-private-key-base64=<api-private-key> \
     --content-provider-id=<itc_team_id> \
     --team-id=<team_id> \
     --distribution-private-key-base64=<distribution-private-key> \
     --distribution-cert-base64=<distribution-cert>
    
    Optionally add the --team-enterprise flag, if your team is in the Apple Developer Enterprise Program. For flavor support add:
     --flavor=prod \
     --main-path lib/main_prod.dart \ # Using "lib/main.dart" by default
     --xcode-scheme prod # Optional, uses flavor if set, or "Runner" by default
    

To create additional provisioning profiles, run in the ios directory:

fastlane sigh -a com.example.ios.to.be.added --api_key_path ApiAuth.json

Web - Server (via Debian only) #

  1. Generate a key pair on your client ssh-keygen -t ed25519 -f $HOME/.ssh/id_ed25519_flutter_release -C flutter_release without a passphrase
  2. Add the output of cat $HOME/.ssh/id_ed25519_flutter_release.pub to your servers $HOME/.ssh/authorized_keys
  3. Convert the private key to a base64 string e.g. base64 --wrap=0 $HOME/.ssh/id_ed25519_flutter_release
  4. Run flutter_release
    flutter_release publish web-server \
     --dry-run \
     --host=host.example.com \
     --path=/var/www/html \
     --ssh-port=22 \
     --ssh-user=<user> \
     --ssh-private-key-base64=<private-key>
    
1
likes
160
points
126
downloads

Publisher

verified publisheroberhauser.dev

Weekly Downloads

A tool for building and publishing Flutter apps, e.g. on GitHub, the Google Play Store and Apple's App Store.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

args, collection, dart_release, flutter_to_debian, path, pub_semver, pubspec_parse

More

Packages that depend on flutter_release