DEV Community

Cover image for Flutter🐬Just One Command to Deploy to both Android and iOS
Kaede Games 🎮
Kaede Games 🎮

Posted on

Flutter🐬Just One Command to Deploy to both Android and iOS

Automation Tasks

  1. Increment of build number and version number
  2. Build and deploy to iOS
  3. Build and deploy to Android

So, let’s get started!

Make .env

ANDROID_UPLOAD_LINK: https://~~~
Enter fullscreen mode Exit fullscreen mode

Make deploy.sh

#!/bin/bash

iosDeploy() {
  echo "🍎 iOS build started 🚀🚀🚀"
  flutter build ipa --release --export-options-plist=ExportOptions.plist
  echo "🍎 iOS build finished 🎉🎉🎉"
}

androidDeploy() {
  echo "🍏 Android build started 🚀🚀🚀"
  flutter build appbundle
  open -R ./build/app/outputs/bundle/release/app-release.aab
  open $ANDROID_UPLOAD_LINK
  echo "🍏 Android build finished 🎉🎉🎉"
}


# Increment version
perl -i -pe 's/^(version:\s+\d+\.\d+\.\d+\+)(\d+)$/$1.($2+1)/e' pubspec.yaml

source .env
# Deploy
iosDeploy &
androidDeploy &

wait
echo "Both builds finished 🎉🎉🎉"
Enter fullscreen mode Exit fullscreen mode

Grant executive authority to deploy.sh

chmod +x deploy.sh
Enter fullscreen mode Exit fullscreen mode

Try the command! 🦄

./deploy.sh
Enter fullscreen mode Exit fullscreen mode

SAYONARA

Top comments (0)