gecko/scripts/build-apk.sh

40 lines
1.4 KiB
Bash
Raw Normal View History

2020-12-14 11:04:13 +01:00
#!/bin/bash
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)
2023-02-01 22:25:26 +01:00
v7_app="app-armeabi-v7a-release.apk"
v8_app="app-arm64-v8a-release.apk"
x86_64_app="app-x86_64-release.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
2023-02-01 22:25:26 +01:00
DL="/tmp"
appPathV7="$DL/${APPNAME}-${VERSION}+${BUILD}-v7a.apk"
appPathV8="$DL/${APPNAME}-${VERSION}+${BUILD}-v8a.apk"
appPathV8="$DL/${APPNAME}-${VERSION}+${BUILD}-x86_64.apk"
mv build/app/outputs/flutter-apk/$v7_app "$appPathV7" || exit 1
mv build/app/outputs/flutter-apk/$v8_app "$appPathV8" || exit 1
mv build/app/outputs/flutter-apk/$x86_64_app "$appPathV8" || exit 1
2022-08-21 06:52:31 +02:00
[[ $withPush == "withPush" ]] && /home/poka/scripts/link/pushGecko $VERSION+$BUILD
exit 0