diff --git a/.gitignore b/.gitignore index 5c2614a..a5212d9 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ app.*.map.json /android/app/release /android/app/.* + +# Ignore the releases folder. +releases/* diff --git a/create_release_files.sh b/create_release_files.sh new file mode 100755 index 0000000..df098a1 --- /dev/null +++ b/create_release_files.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +DIR="$(dirname -- "${BASH_SOURCE[0]}")" +RELEASE_DIR=$DIR/releases + + +echo "*** Prepare for Builds ***" +cd $DIR +pwd +mkdir -pv $RELEASE_DIR + +echo "*** Get Version ***" +grep 'version:' pubspec.yaml | while read v_text v_number; do + # Skip any newlines found while grepping. + if [[ -z $v_number ]]; then + continue + fi + + echo "Creating assets for version '$v_number'." + + # Set Up Variables + ANDROID_APK="build/app/outputs/flutter-apk/app-release.apk" + APK_RENAME="$RELEASE_DIR/ExpenseTracker_$v_number.apk" + LINUX_BUNDLE="build/linux/x64/release/bundle" + BUNDLE_RENAME="LinuxBundle_$v_number" + + # Build Android App + echo -e "\n*** Android APK ***" + rm -v "$APK_RENAME" + flutter build apk + mv -v $ANDROID_APK "$APK_RENAME" + ls -sh "$APK_RENAME" + + # Build Linux Project + echo -e "\n*** Linux Bundle ***" + rm -rv "$RELEASE_DIR/$BUNDLE_RENAME"* + flutter build linux + mv -v $LINUX_BUNDLE "$RELEASE_DIR/$BUNDLE_RENAME" + cd $RELEASE_DIR + zip -r $BUNDLE_RENAME.zip $BUNDLE_RENAME + rm -rv $BUNDLE_RENAME + ls -sh $BUNDLE_RENAME.zip + + # Only one version should be found, but just in case, only use the top one! + break +done