mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 04:05:06 -04:00
Added staging deploy
This commit is contained in:
parent
934670b2a7
commit
c8c12fdd29
14 changed files with 242 additions and 164 deletions
56
build.sh
Normal file
56
build.sh
Normal 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
|
57
deploy.sh
57
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"
|
||||
|
|
13
deploy_staging.sh
Executable file
13
deploy_staging.sh
Executable file
|
@ -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
|
221
dist/index.html
vendored
221
dist/index.html
vendored
File diff suppressed because one or more lines are too long
33
dist/sw-b71.js
vendored
Normal file
33
dist/sw-b71.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// The version of the cache.
|
||||
const VERSION = '29032991';
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
// The static resources that the app needs to function.
|
||||
const APP_STATIC_RESOURCES = [
|
||||
"/"
|
||||
];
|
||||
// On install, cache the static resources
|
||||
self.addEventListener("install", (event)=>{
|
||||
event.waitUntil((async ()=>{
|
||||
const cache = await caches.open(CACHE_NAME);
|
||||
cache.addAll(APP_STATIC_RESOURCES);
|
||||
})());
|
||||
});
|
||||
// delete old caches on activate
|
||||
self.addEventListener("activate", (event)=>{
|
||||
event.waitUntil((async ()=>{
|
||||
const names = await caches.keys();
|
||||
await Promise.all(names.map((name)=>{
|
||||
if (name !== CACHE_NAME) return caches.delete(name);
|
||||
}));
|
||||
await clients.claim();
|
||||
})());
|
||||
});
|
||||
self.addEventListener("fetch", (event)=>{
|
||||
if (event.request.mode === "navigate" && event.request.url.endsWith('/index.html?isPWA=true')) {
|
||||
event.respondWith(caches.match("/"));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=sw-b71.js.map
|
1
dist/sw-b71.js.map
vendored
Normal file
1
dist/sw-b71.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"mappings":"AAAA,4BAA4B;AAC5B,MAAO,UAAU;AAEjB,wBAAwB;AACxB,MAAM,aAAa,CAAC,YAAY,EAAE,SAAS;AAE3C,uDAAuD;AACvD,MAAM,uBAAuB;IAC3B;CACD;AAED,yCAAyC;AACzC,KAAK,gBAAgB,CAAC,WAAW,CAAC;IAChC,MAAM,SAAS,CACb,AAAC,CAAA;QACC,MAAM,QAAQ,MAAM,OAAO,IAAI,CAAC;QAChC,MAAM,MAAM,CAAC;IACf,CAAA;AAEJ;AAEA,gCAAgC;AAChC,KAAK,gBAAgB,CAAC,YAAY,CAAC;IACjC,MAAM,SAAS,CACb,AAAC,CAAA;QACC,MAAM,QAAQ,MAAM,OAAO,IAAI;QAC/B,MAAM,QAAQ,GAAG,CACf,MAAM,GAAG,CAAC,CAAC;YACT,IAAI,SAAS,YACX,OAAO,OAAO,MAAM,CAAC;QAEzB;QAEF,MAAM,QAAQ,KAAK;IACrB,CAAA;AAEJ;AAEA,KAAK,gBAAgB,CAAC,SAAS,CAAC;IAC9B,IAAI,MAAM,OAAO,CAAC,IAAI,KAAK,cAAc,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,2BAA2B;QAC7F,MAAM,WAAW,CAAC,OAAO,KAAK,CAAC;QAC/B;IACF;AACF","sources":["src/sw-b71.js"],"sourcesContent":["// The version of the cache.\nconst VERSION = '29032991'\n\n// The name of the cache\nconst CACHE_NAME = `breakout-71-${VERSION}`;\n\n// The static resources that the app needs to function.\nconst APP_STATIC_RESOURCES = [\n \"/\"\n];\n\n// On install, cache the static resources\nself.addEventListener(\"install\", (event) => {\n event.waitUntil(\n (async () => {\n const cache = await caches.open(CACHE_NAME);\n cache.addAll(APP_STATIC_RESOURCES);\n })(),\n );\n});\n\n// delete old caches on activate\nself.addEventListener(\"activate\", (event) => {\n event.waitUntil(\n (async () => {\n const names = await caches.keys();\n await Promise.all(\n names.map((name) => {\n if (name !== CACHE_NAME) {\n return caches.delete(name);\n }\n }),\n );\n await clients.claim();\n })(),\n );\n});\n\nself.addEventListener(\"fetch\", (event) => {\n if (event.request.mode === \"navigate\" && event.request.url.endsWith('/index.html?isPWA=true')) {\n event.respondWith(caches.match(\"/\"));\n return;\n }\n});\n"],"names":[],"version":3,"file":"sw-b71.js.map","sourceRoot":"/__parcel_source_root/"}
|
21
package-lock.json
generated
21
package-lock.json
generated
|
@ -26,6 +26,7 @@
|
|||
"svgo": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-webmanifest": "^2.13.3",
|
||||
"@types/jest": "^29.5.14",
|
||||
"jest": "^29.7.0",
|
||||
"ts-jest": "^29.2.6",
|
||||
|
@ -2454,6 +2455,26 @@
|
|||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/transformer-webmanifest": {
|
||||
"version": "2.13.3",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/transformer-webmanifest/-/transformer-webmanifest-2.13.3.tgz",
|
||||
"integrity": "sha512-nUuufZW4VYQTk1qf8HLLckxC5AYtGSWMAHxKTqoJldXl1OgpYkpSPLU+Uh1uiESN+XpQiZB4qnhCExRjPeCRSA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@mischnic/json-sourcemap": "^0.1.0",
|
||||
"@parcel/diagnostic": "2.13.3",
|
||||
"@parcel/plugin": "2.13.3",
|
||||
"@parcel/utils": "2.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"parcel": "^2.13.3"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/types": {
|
||||
"version": "2.13.3",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/types/-/types-2.13.3.tgz",
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
"svgo": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@parcel/transformer-webmanifest": "^2.13.3",
|
||||
"@types/jest": "^29.5.14",
|
||||
"jest": "^29.7.0",
|
||||
"ts-jest": "^29.2.6",
|
||||
|
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
|
@ -1,4 +1,5 @@
|
|||
if ("serviceWorker" in navigator &&
|
||||
window.location.search.includes("isPWA=true")) {
|
||||
navigator.serviceWorker.register("sw-b71.js");
|
||||
// @ts-ignore
|
||||
navigator.serviceWorker.register(new URL('sw-b71.js', import.meta.url));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue