Skip to content

Commit

Permalink
Create a script to auto build for Android and show checksums
Browse files Browse the repository at this point in the history
  • Loading branch information
Kara-Zor-El committed May 19, 2023
1 parent a39c3f6 commit d81b695
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ app.*.map.json
libisar.so
android/app/build.gradle
android/app/src/main/AndroidManifest.xml
sha1sums.txt
47 changes: 47 additions & 0 deletions build-android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# Check if file exists
if [ -f "sha1sums.txt" ]; then
rm sha1sums.txt
fi
touch sha1sums.txt

# Build debug version
flutter build apk --debug
flutter build apk --debug --split-per-abi

# Get the SHA1 Checksums of the APKs and save them to a file with the following format:
# <code>filename</code>: <code>checksum</code>
declare -a fileName=( $(find build/app/outputs/flutter-apk -type f -name "*.apk") )
declare -a fileChecksum

# Build debug AAB version
flutter build appbundle --debug
fileName=$(find build/app/outputs/bundle/debug/ -type f -name "*.aab")
fileChecksum=$(sha1sum "$fileName" | awk '{print $1}')
fileName=${fileName##*/}
fileName=${fileName/app-/JellyBook-}
echo "<code>$fileName</code>: <code>$fileChecksum</code>" | tee -a sha1sums.txt

# Build release version
flutter build apk --release
flutter build apk --release --split-per-abi

declare -a fileName=( $(find build/app/outputs/flutter-apk/ -type f -name "*.apk") )
declare -a fileChecksum

for file in "${fileName[@]}"; do
checksum=$(sha1sum "$file" | awk '{print $1}')
fileChecksum+=("$checksum")
file=${file##*/}
file=${file/app-/JellyBook-}
echo "<code>$file</code>: <code>$checksum</code>" | tee -a sha1sums.txt
done

# Build release AAB version
flutter build appbundle --release
fileName=$(find build/app/outputs/bundle/release/ -type f -name "*.aab")
fileChecksum=$(sha1sum "$fileName" | awk '{print $1}')
fileName=${fileName##*/}
fileName=${fileName/app-/JellyBook-}
echo "<code>$fileName</code>: <code>$fileChecksum</code>" | tee -a sha1sums.txt

0 comments on commit d81b695

Please sign in to comment.