v0.1.2: Add VERSION.txt with build-time injection

This commit is contained in:
lotherk
2026-03-27 14:50:20 +00:00
parent 4a870dd5e3
commit b42801b6c5
7 changed files with 44 additions and 5 deletions

22
build-version.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Build script: injects version from VERSION.txt into all build-time locations
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$SCRIPT_DIR"
VERSION=$(cat "$ROOT_DIR/VERSION.txt")
echo "Injecting version $VERSION..."
# Backend version constant
sed -i "s/const DEARDIARY_VERSION = '[^']*'/const DEARDIARY_VERSION = '$VERSION'/" "$ROOT_DIR/backend/src/index.ts"
# Backend package.json
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" "$ROOT_DIR/backend/package.json"
# Frontend package.json
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" "$ROOT_DIR/frontend/package.json"
echo "Done."