mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-18 20:22:42 -06:00
- server/version.js: shared version helper that reads the root VERSION file once (fallback 0.0.0). Replaces the stale hardcoded 1.2.0 / 1.5.1 / 1.0.0 fallbacks in /api/version, /api/update/check, and /api/status. - config.js: DATA_DIR / DB_PATH / UPLOADS_DIR / CERTS_DIR env overrides for the db, uploads, and certs/jwt-secret locations. Unset resolves to exactly the legacy in-repo paths, so existing installs (including production) are byte-for-byte unchanged. Guarded by test/config-paths.test.js. - package.json: rename remote-display-server -> screentinker (+ lockfile name). - scripts/bump-version.sh: one-shot bump across VERSION, package.json (+lock), android (versionName and versionCode + 1), and the tizen widget version; makes one commit plus an annotated tag; prints the push command, never pushes. - .gitignore: global *.db / *.db-wal / *.db-shm / *.db.* so no database file (including .db.devbak backups, at any path) can be committed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
2.5 KiB
Bash
Executable file
58 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
# Bump the ScreenTinker version across every source of truth in one commit + tag.
|
|
#
|
|
# scripts/bump-version.sh major|minor|patch|X.Y.Z
|
|
#
|
|
# Updates (and commits together): VERSION (root, the value the server reads at
|
|
# runtime), server/package.json + package-lock.json, android versionName
|
|
# (+versionCode by 1), tizen/config.xml widget version. Then creates an annotated
|
|
# tag vX.Y.Z. Does NOT push - prints the push command, so a release fires
|
|
# deliberately (pushing the tag is what triggers the release workflow).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Require a clean tree so the version commit can't sweep up unrelated changes.
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
echo "ERROR: working tree is dirty - commit or stash before bumping." >&2
|
|
exit 1
|
|
fi
|
|
|
|
CURRENT="$(cat VERSION)"
|
|
IFS=. read -r MAJ MIN PAT <<< "$CURRENT"
|
|
|
|
case "${1:-}" in
|
|
major) NEW="$((MAJ + 1)).0.0" ;;
|
|
minor) NEW="${MAJ}.$((MIN + 1)).0" ;;
|
|
patch) NEW="${MAJ}.${MIN}.$((PAT + 1))" ;;
|
|
[0-9]*.[0-9]*.[0-9]*) NEW="$1" ;;
|
|
*) echo "usage: $0 major|minor|patch|X.Y.Z (current: $CURRENT)" >&2; exit 1 ;;
|
|
esac
|
|
echo "Bumping $CURRENT -> $NEW"
|
|
|
|
# 1) VERSION (source of truth)
|
|
printf '%s\n' "$NEW" > VERSION
|
|
|
|
# 2) server/package.json version + lockfile (only the top-level "version" key;
|
|
# dependency entries are "name": "^x.y.z" and won't match "version": "x.y.z")
|
|
sed -i -E "s/(\"version\"[[:space:]]*:[[:space:]]*)\"[0-9]+\.[0-9]+\.[0-9]+\"/\1\"$NEW\"/" server/package.json
|
|
( cd server && npm install --package-lock-only >/dev/null )
|
|
|
|
# 3) android versionName + versionCode (+1)
|
|
sed -i -E "s/(versionName[[:space:]]*=[[:space:]]*)\"[0-9.]+\"/\1\"$NEW\"/" android/app/build.gradle.kts
|
|
CODE="$(grep -oE 'versionCode[[:space:]]*=[[:space:]]*[0-9]+' android/app/build.gradle.kts | grep -oE '[0-9]+$')"
|
|
sed -i -E "s/(versionCode[[:space:]]*=[[:space:]]*)[0-9]+/\1$((CODE + 1))/" android/app/build.gradle.kts
|
|
|
|
# 4) tizen widget version. Leading-space guard targets the widget's version="..."
|
|
# attribute and NOT tizen:application required_version="..." (no space before
|
|
# "version" there - it's "...d_version").
|
|
sed -i -E "s/([[:space:]]version=\")[0-9][^\"]*(\")/\1${NEW}\2/" tizen/config.xml
|
|
|
|
# 5) commit + annotated tag (no push)
|
|
git add VERSION server/package.json server/package-lock.json android/app/build.gradle.kts tizen/config.xml
|
|
git commit -q -m "chore(release): v$NEW"
|
|
git tag -a "v$NEW" -m "ScreenTinker v$NEW"
|
|
|
|
echo
|
|
echo "Committed + tagged v$NEW (nothing pushed). To release:"
|
|
echo " git push origin main && git push origin v$NEW"
|