breakout71/build.sh

51 lines
1.1 KiB
Bash
Raw Normal View History

2025-03-14 22:14:57 +01:00
#!/bin/bash
2025-03-14 22:21:47 +01:00
# the version number is just a unix timestamp in minutes
defaultVersionCode=$(($(date +%s) / 60))
versionCode=${1:-$defaultVersionCode}
2025-03-14 22:21:47 +01:00
2025-03-14 22:14:57 +01:00
source ~/.nvm/nvm.sh;
nvm install v21
nvm use v21
if [[ $(node --version) != v21* ]]; then
echo "run first: nvm use v21"
exit 1
fi
set -e
set -x
# Replace the version code and name in gradle for fdroid and play store
sed -i -e "s/^[[:space:]]*versionCode = .*/ versionCode = $versionCode/" \
-e "s/^[[:space:]]*versionName = .*/ versionName = \"$versionCode\"/" \
./app/build.gradle.kts
2025-03-16 17:45:29 +01:00
echo "\"$versionCode\"" > src/data/version.json
2025-03-14 22:14:57 +01:00
# Update service worker
2025-03-16 17:45:29 +01:00
sed -i -e "s/VERSION = .*/ VERSION = '$versionCode'/" ./src/PWA/sw-b71.js
2025-03-14 22:14:57 +01:00
# remove all exif metadata from pictures, because i think fdroid doesn't like that. odd
find -name '*.jp*g' -o -name '*.png' | xargs exiftool -all= -overwrite_original
2025-03-14 22:14:57 +01:00
npx prettier --write src/
2025-03-16 17:45:29 +01:00
npx jest
rm -rf build/*
npx parcel build src/index.html --dist-dir build
2025-03-14 22:14:57 +01:00
rm -rf ./app/src/main/assets/*
cp public/* build
rm -rf ./app/src/main/assets/*
cp build/index.html ./app/src/main/assets/
2025-04-02 17:46:34 +02:00
# generate signed apk
./gradlew assembleRelease