Last active
February 26, 2024 10:16
-
-
Save rodydavis/774b36e32d7efa882cca8dd16da6e74c to your computer and use it in GitHub Desktop.
Flutter Release Script with Fastlane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "App Release Automator by @rodydavis" | |
action="$1" | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
if [ ${action} = "build" ]; then | |
echo "${green}Generating built files.. ${reset}" | |
flutter packages pub run build_runner clean | |
flutter packages pub run build_runner build --delete-conflicting-outputs | |
pub global activate pubspec_version | |
git commit -a -m "Build $(pubver bump patch)" | |
echo "${green}Building Project...${reset}" | |
find . -name "*-e" -type f -delete | |
flutter format . | |
flutter clean | |
echo "${green}Project Size: $(find . -name "*.dart" | xargs cat | wc -c)${reset}" | |
echo "${green}Building APK...${reset}" | |
flutter build apk | |
echo "${green}Builing IPA..${reset}" | |
cd ./ios && pod install && pod repo update && cd .. | |
flutter build ios | |
git commit -a -m "Project Rebuilt" | |
elif [ ${action} = "beta" ]; then | |
echo "${green}Generating built files..${reset}" | |
flutter packages pub run build_runner clean | |
flutter packages pub run build_runner build --delete-conflicting-outputs | |
pub global activate pubspec_version | |
git commit -a -m "Beta $(pubver bump patch)" | |
echo "${green}Building Project...${reset}" | |
find . -name "*-e" -type f -delete | |
flutter format . | |
flutter clean | |
echo "${green}Project Size: $(find . -name "*.dart" | xargs cat | wc -c)${reset}" | |
echo "${green}Building APK...${reset}" | |
flutter build apk | |
echo "${green}Sending Android to Beta...${reset}" | |
cd ./android && fastlane beta && cd .. | |
echo "${green}Builing IPA..${reset}" | |
flutter build ios | |
echo "${green}Sending iOS to Beta..${reset}" | |
cd ./ios && fastlane beta && cd .. | |
git commit -a -m "Sent to Beta" | |
elif [ ${action} = "release" ]; then | |
echo "${green}Generating built files..${reset}" | |
flutter packages pub run build_runner clean | |
flutter packages pub run build_runner build --delete-conflicting-outputs | |
pub global activate pubspec_version | |
git commit -a -m "Production $(pubver bump minor)" | |
echo "${green}Building Project...${reset}" | |
find . -name "*-e" -type f -delete | |
flutter format . | |
flutter clean | |
echo "${green}Project Size: $(find . -name "*.dart" | xargs cat | wc -c)${reset}" | |
echo "${green}Building APK...${reset}" | |
flutter build apk | |
echo "${green}Sending Android to Production...${reset}" | |
cd ./android && fastlane release && cd .. | |
echo "${green}Builing IPA..${reset}" | |
flutter build ios | |
echo "${green}Sending iOS to Production...${reset}" | |
cd ./ios && fastlane release && cd .. | |
git commit -a -m "Sent to Production" | |
fi | |
echo "${green}Successfully completed${reset}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is just what i need !
I am making all these sort of scripts cross platform so that its possible to build on any OS.
This is easily done with golang using Task. Have a look. https://github.com/go-task/task
All the complex stuff is just written as golang commands. I can take a crack at this if you want.
Once its done then you have it for all flutter projects because its on your path. Makes working consistently on projects easier.
Also the exact same golang binary is used for CI, so you dont end up having different script for the CI system your using.