From c8c12fdd291e54438c575b263d99e2e6be10ed56 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Fri, 14 Mar 2025 22:14:57 +0100 Subject: [PATCH] Added staging deploy --- build.sh | 56 +++++++++ deploy.sh | 57 +-------- deploy_staging.sh | 13 ++ dist/index.html | 221 ++++++++++++++++++---------------- dist/sw-b71.js | 33 +++++ dist/sw-b71.js.map | 1 + package-lock.json | 21 ++++ package.json | 1 + {public => src}/icon-128.png | Bin {public => src}/icon-512.png | Bin {public => src}/icon-64.png | Bin {public => src}/manifest.json | 0 {public => src}/sw-b71.js | 0 src/sw_loader.ts | 3 +- 14 files changed, 242 insertions(+), 164 deletions(-) create mode 100644 build.sh create mode 100755 deploy_staging.sh create mode 100644 dist/sw-b71.js create mode 100644 dist/sw-b71.js.map rename {public => src}/icon-128.png (100%) rename {public => src}/icon-512.png (100%) rename {public => src}/icon-64.png (100%) rename {public => src}/manifest.json (100%) rename {public => src}/sw-b71.js (100%) diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..4a1bd89 --- /dev/null +++ b/build.sh @@ -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 diff --git a/deploy.sh b/deploy.sh index c569c71..2ab07ca 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,61 +1,6 @@ #!/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'/" ./public/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 and deploy of version $versionCode" -git tag -a $versionCode -m $versionCode -git push +bash ./build.sh # upload to breakout.lecaro.me DOMAIN="breakout.lecaro.me" diff --git a/deploy_staging.sh b/deploy_staging.sh new file mode 100755 index 0000000..ed35e3e --- /dev/null +++ b/deploy_staging.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +bash ./build.sh + +# upload to breakout-v3-staging.lecaro.me +DOMAIN="breakout-v3-staging.lecaro.me" +PUBLIC_CONTENT="./dist/*" + +ssh staging "mkdir -p /opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN" +rsync -avz --delete $PUBLIC_CONTENT staging:/opt/mup-nginx-proxy/config/html/static_sites/$DOMAIN + +# upload to itch.io , upload the index file directly +butler push "./dist/index.html" renanlecaro/breakout71:nightly --userversion $versionCode diff --git a/dist/index.html b/dist/index.html index d126e5f..bffd66c 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,11 +1,13 @@ - + Breakout 71 + +