breakout71/deploy.sh

37 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
2025-02-15 22:22:57 +01:00
set -e
set -x
2025-02-15 20:44:39 +01:00
# Replace the version code and name in gradle for fdroid and play store
versionCode=$(($(date +%s) / 60))
2025-02-15 22:22:57 +01:00
2025-02-15 22:24:33 +01:00
# On macOS you should use -i '' not just -i, but i'm on linux
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-02-15 20:49:00 +01:00
2025-02-19 21:11:22 +01:00
# Invalidate web cache and update version
2025-02-15 20:49:00 +01:00
sed -i "s/\?v=[0-9]*/\?v=$versionCode/g" ./app/src/main/assets/index.html
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-02-15 20:49:00 +01:00
2025-02-15 20:47:26 +01:00
git add .
git commit -m "Automatic deploy $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-02-15 20:44:39 +01:00
DOMAIN="breakout.lecaro.me"
PUBLIC_CONTENT="./app/src/main/assets/"
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
# generate zip for itch
2025-02-17 17:52:20 +01:00
#rm -f breakout.zip
#zip -j breakout.zip app/src/main/assets/*
butler push app/src/main/assets/ renanlecaro/breakout71:latest --userversion $versionCode