gecko/scripts/build-apk.sh

44 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2020-12-14 11:04:13 +01:00
#!/bin/bash
# [[ -z $1 ]] && echo "Please choose a version." && exit 1
2020-12-16 02:50:57 +01:00
fVersion=$(grep "version: " pubspec.yaml | awk '{ print $2 }')
2020-12-14 11:04:13 +01:00
withPush=$1
2020-12-16 02:50:57 +01:00
APPNAME="gecko"
VERSION=$(awk -F '+' '{ print $1 }' <<<$fVersion)
BUILD=$(awk -F '+' '{ print $2 }' <<<$fVersion)
ori_app="app.apk"
echo "Nom du build final: ${APPNAME}-${VERSION}+${BUILD}.apk"
2022-08-21 06:52:31 +02:00
[[ $withPush == "withPush" ]] && echo "Publish after build"
## To build Rust dependancies
# cargo br
2022-08-21 06:52:31 +02:00
#flutter clean
if [[ $1 == "bundle" ]]; then
flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
else
# flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
flutter build apk --release --split-per-abi --build-name $VERSION --build-number $BUILD
# flutter build apk --release --build-name $VERSION --build-number $BUILD
fi
2022-05-27 12:54:25 +02:00
if [[ -d $HOME/kDrive/Gecko-APK ]]; then
DL="$HOME/kDrive/Gecko-APK"
2022-05-20 16:02:42 +02:00
elif [[ -d $HOME/Téléchargements ]]; then
DL="$HOME/Téléchargements"
elif [[ -d $HOME/Downloads ]]; then
DL="$HOME/Downloads"
else
DL="/tmp"
fi
appPath="$DL/${APPNAME}-${VERSION}+${BUILD}.apk"
2022-08-21 06:52:31 +02:00
mv build/app/outputs/flutter-apk/$ori_app "$appPath" || exit 1
2022-08-21 06:52:31 +02:00
[[ $withPush == "withPush" ]] && /home/poka/scripts/link/pushGecko $VERSION+$BUILD
exit 0