From 5212f586c7a8c9e0ac05df49190cfc44c0bc37b2 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Fri, 27 Mar 2026 08:06:57 +0100 Subject: [PATCH] Auto-inject version from git tags in deploy Reads version from git describe, injects into i18n.js and index.html before minification. No manual version bumping needed. Tag with: git tag v1.1.0 --- scripts/deploy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 3bff4e6..d5ffbc0 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -68,6 +68,15 @@ else echo "Skipping pre-deploy backup (DEPLOY_BACKUP_ENABLE=0)." fi +# ── Inject version from git tags ────────────────────────────────────────────── +GIT_VERSION=$(git describe --tags --always 2>/dev/null || echo "dev") +# Turn v1.0.0-3-gabc1234 into 1.0.0+3 +VERSION=$(echo "$GIT_VERSION" | sed -E 's/^v//; s/-([0-9]+)-g[0-9a-f]+$/+\1/') +echo "Version: $VERSION" + +sed -i -E "s|VERSION = '[^']*'|VERSION = '${VERSION}'|" i18n.js +sed -i -E "s|(v)[^<]*()|\1${VERSION}\2|" index.html + # ── Minify & update SRI hashes ──────────────────────────────────────────────── echo "Minifying JS..." TERSER="${TERSER:-terser}"