Update Flutter submodule and make GitHub actions error out if it doesn't match latest/stable

This commit is contained in:
Imran Remtulla
2024-01-22 12:21:38 -05:00
parent fac335c849
commit f06de8d19f
3 changed files with 22 additions and 8 deletions

View File

@ -23,16 +23,27 @@ jobs:
gpg_private_key: ${{ secrets.PGP_KEY_BASE64 }} gpg_private_key: ${{ secrets.PGP_KEY_BASE64 }}
passphrase: ${{ secrets.PGP_PASSPHRASE }} passphrase: ${{ secrets.PGP_PASSPHRASE }}
- name: Check submodule
id: check_submodule
run: |
SUBMODULE_COMMIT="$(cd .flutter; git rev-parse --short HEAD; cd ..)"
FLUTTER_COMMIT="$(flutter --version | head -2 | tail -1 | awk '{print $4}')"
echo "SUBMODULE_COMMIT=$SUBMODULE_COMMIT, FLUTTER_COMMIT=$FLUTTER_COMMIT"
if [ "$SUBMODULE_COMMIT" != "$FLUTTER_COMMIT" ]; then
echo "Your submodule has not been updated!"
exit 1
fi
- name: Extract Version - name: Extract Version
id: extract_version id: extract_version
run: | run: |
VERSION=$(grep -oP "^version: [^\+]+" pubspec.yaml | tail -c +10) VERSION=$(grep -oP "^version: [^\+]+" pubspec.yaml | tail -c +10)
echo "version=$VERSION" >> $GITHUB_OUTPUT echo "version=$VERSION" >> $GITHUB_OUTPUT
if [ ${{ inputs.beta }} == true ]; then BETA=true; else BETA=false; fi if [ ${{ inputs.beta }} == true ]; then BETA=true; else BETA=false; fi
echo "beta=$BETA" >> $GITHUB_OUTPUT echo "beta=$BETA" >> $GITHUB_OUTPUT
TAG="v$VERSION" TAG="v$VERSION"
if [ $BETA == true ]; then TAG="$TAG"-beta; fi if [ $BETA == true ]; then TAG="$TAG"-beta; fi
echo "tag=$TAG" >> $GITHUB_OUTPUT echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Build APKs - name: Build APKs
run: | run: |

View File

@ -7,6 +7,9 @@ trap "cd "$CURR_DIR"" EXIT
if [ -z "$1" ]; then if [ -z "$1" ]; then
git fetch && git merge origin/main && git push # Typically run after a PR to main, so bring dev up to date git fetch && git merge origin/main && git push # Typically run after a PR to main, so bring dev up to date
fi fi
cd .flutter
git checkout "$(flutter --version | head -2 | tail -1 | awk '{print $4}')" # Ensure included Flutter submodule version equals my environment
cd ..
rm ./build/app/outputs/flutter-apk/* 2>/dev/null # Get rid of older builds if any rm ./build/app/outputs/flutter-apk/* 2>/dev/null # Get rid of older builds if any
flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal # Build (both split and combined APKs) flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal # Build (both split and combined APKs)
for file in ./build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done for file in ./build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done