2025-02-15 19:21:00 +01:00
|
|
|
#!/bin/bash
|
2025-03-13 08:55:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
source ~/.nvm/nvm.sh;
|
|
|
|
|
|
|
|
|
|
|
|
nvm install v21
|
|
|
|
nvm use v21
|
|
|
|
|
2025-03-05 22:16:09 +01:00
|
|
|
if [[ $(node --version) != v21* ]]; then
|
|
|
|
echo "run first: nvm use v21"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2025-03-05 22:21:39 +01:00
|
|
|
|
2025-03-05 22:22:24 +01:00
|
|
|
if grep -rE "T[O]DO|F[I]XME|console\.log" src
|
2025-03-05 22:21:39 +01:00
|
|
|
then
|
2025-03-05 22:46:37 +01:00
|
|
|
echo "You have left some TO""DO or logs"
|
2025-03-05 22:21:39 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2025-02-15 22:22:57 +01:00
|
|
|
set -e
|
|
|
|
set -x
|
2025-02-15 19:21:00 +01:00
|
|
|
|
2025-03-05 19:50:17 +01:00
|
|
|
# the version number is just a unix timestamp in minutes
|
2025-02-15 20:44:39 +01:00
|
|
|
versionCode=$(($(date +%s) / 60))
|
2025-02-15 22:22:57 +01:00
|
|
|
|
2025-03-12 15:15:30 +01:00
|
|
|
|
2025-03-05 19:50:17 +01:00
|
|
|
# Replace the version code and name in gradle for fdroid and play store
|
2025-02-15 22:23:52 +01:00
|
|
|
sed -i -e "s/^[[:space:]]*versionCode = .*/ versionCode = $versionCode/" \
|
2025-02-15 20:49:00 +01:00
|
|
|
-e "s/^[[:space:]]*versionName = .*/ versionName = \"$versionCode\"/" \
|
2025-02-15 20:44:39 +01:00
|
|
|
./app/build.gradle.kts
|
|
|
|
|
2025-03-05 22:10:17 +01:00
|
|
|
echo "\"$versionCode\"" > src/version.json
|
2025-02-15 22:19:13 +01:00
|
|
|
|
2025-02-15 22:20:00 +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=
|
|
|
|
|
2025-03-12 15:15:30 +01:00
|
|
|
|
2025-03-06 16:46:25 +01:00
|
|
|
npx prettier --write src/
|
|
|
|
|
2025-03-05 22:10:17 +01:00
|
|
|
npm run build
|
|
|
|
|
|
|
|
rm -rf ./app/src/main/assets/*
|
|
|
|
cp public/* dist
|
|
|
|
cp dist/* ./app/src/main/assets/
|
|
|
|
|
|
|
|
|
2025-03-05 19:50:17 +01:00
|
|
|
# Create a release commit and tag
|
2025-02-15 20:47:26 +01:00
|
|
|
git add .
|
2025-03-05 22:10:17 +01:00
|
|
|
git commit -m "Build and deploy of version $versionCode"
|
2025-02-15 21:14:19 +01:00
|
|
|
git tag -a $versionCode -m $versionCode
|
2025-02-15 20:47:26 +01:00
|
|
|
git push
|
|
|
|
|
2025-03-05 19:50:17 +01:00
|
|
|
# upload to breakout.lecaro.me
|
2025-02-15 19:21:00 +01:00
|
|
|
DOMAIN="breakout.lecaro.me"
|
2025-03-05 22:51:19 +01:00
|
|
|
PUBLIC_CONTENT="./dist/*"
|
2025-03-05 22:10:17 +01:00
|
|
|
|
2025-02-15 19:21:00 +01:00
|
|
|
ssh staging "mkdir -p /opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN"
|
|
|
|
rsync -avz --delete --delete-excluded --exclude="*.sh" --exclude="node_modules" --exclude="android" --exclude=".*" $PUBLIC_CONTENT staging:/opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN
|
|
|
|
|
2025-03-05 22:46:37 +01:00
|
|
|
# upload to itch.io , upload the index file directly
|
|
|
|
butler push "./dist/index.html" renanlecaro/breakout71:latest --userversion $versionCode
|
|
|
|
butler push "./dist/index.html" renanlecaro/breakout71:offline --userversion $versionCode
|