Added staging deploy

This commit is contained in:
Renan LE CARO 2025-03-14 22:14:57 +01:00
parent 934670b2a7
commit c8c12fdd29
14 changed files with 242 additions and 164 deletions

56
build.sh Normal file
View file

@ -0,0 +1,56 @@
#!/bin/bash
source ~/.nvm/nvm.sh;
nvm install v21
nvm use v21
if [[ $(node --version) != v21* ]]; then
echo "run first: nvm use v21"
exit 1
fi
if grep -rE "T[O]DO|F[I]XME|console\.log" src
then
echo "You have left some TO""DO or logs"
exit 1
fi
set -e
set -x
# the version number is just a unix timestamp in minutes
versionCode=$(($(date +%s) / 60))
# 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
echo "\"$versionCode\"" > src/version.json
# Update service worker
sed -i -e "s/VERSION = .*/ VERSION = '$versionCode'/" ./src/sw-b71.js
# 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=
npx prettier --write src/
npm run build
rm -rf ./app/src/main/assets/*
cp public/* dist
cp dist/* ./app/src/main/assets/
# Create a release commit and tag
git add .
git commit -m "Build $versionCode"
git tag -a $versionCode -m $versionCode
git push