Version alignment + release script — single source of truth

Aligns every version string in the repo to 6.1.0:
  - package.json: 6.0.0 → 6.1.0
  - mobile/package.json: 1.0.0 → 6.1.0
  - mobile/android/app/build.gradle: versionCode 1 → 610,
      versionName "1.0" → "6.1.0"
  - server.js: hardcoded "v6.0" → reads root package.json at boot
  - /api/health/detailed now reports APP_VERSION from package.json

Adds scripts/release.sh — a one-command bump:
  scripts/release.sh 6.1.1                # local bump + tag
  scripts/release.sh 6.1.1 --push         # + git push
  scripts/release.sh 6.1.1 --push --gh    # + GitHub release (uploads
                                            APK if already built)

Updates all three version sites, commits "Release v6.1.1",
creates annotated tag, optionally pushes and opens a release.
versionCode encoded as MAJ*100000 + MIN*1000 + PATCH so patch
updates always increment monotonically.
This commit is contained in:
Daniel 2026-04-14 23:18:47 +02:00
parent 77bd7c5b1c
commit 73398e91ed
5 changed files with 130 additions and 6 deletions

View file

@ -7,8 +7,10 @@ android {
applicationId "com.pedshub.scribe"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
// Version values below are overwritten by scripts/release.sh from
// the root package.json. versionCode auto-increments per release.
versionCode 610
versionName "6.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.

View file

@ -1,6 +1,6 @@
{
"name": "pedscribe-mobile",
"version": "1.0.0",
"version": "6.1.0",
"description": "PedScribe native mobile app — Capacitor wrapper for Pediatric AI Scribe",
"private": true,
"scripts": {

View file

@ -1,6 +1,6 @@
{
"name": "pediatric-ai-scribe",
"version": "6.0.0",
"version": "6.1.0",
"description": "AI-powered pediatric clinical documentation platform",
"main": "server.js",
"scripts": {

121
scripts/release.sh Executable file
View file

@ -0,0 +1,121 @@
#!/usr/bin/env bash
# ============================================================
# PedScribe release helper — one command to tag a new version.
#
# Usage:
# scripts/release.sh 6.1.1 # bump to 6.1.1
# scripts/release.sh 6.1.1 --push # also git push + tag push
# scripts/release.sh 6.2.0 --push --gh # also create GitHub release
#
# What it does:
# 1. Updates version in root package.json
# 2. Updates version in mobile/package.json
# 3. Updates versionName + bumps versionCode in Android build.gradle
# 4. Commits the version bump
# 5. (optional) git push + push the new tag
# 6. (optional) create a GitHub release via gh CLI
#
# It does NOT:
# - Build the Docker image (run `docker compose build`/`up -d` yourself
# or wire it to a deploy script / CI hook)
# - Build the Android APK (run `cd mobile/android && ./gradlew ...`
# yourself). This script just marks the version so the build tags
# correctly.
# ============================================================
set -euo pipefail
VERSION="${1:-}"
PUSH=false
DO_RELEASE=false
for arg in "${@:2}"; do
case "$arg" in
--push) PUSH=true ;;
--gh) DO_RELEASE=true ;;
esac
done
if [[ -z "$VERSION" ]]; then
echo "usage: $0 <version> [--push] [--gh]"
echo " example: $0 6.1.1 --push --gh"
exit 1
fi
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: version must be semver X.Y.Z (e.g. 6.1.1). got: $VERSION" >&2
exit 1
fi
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
if [[ -n "$(git status --porcelain)" ]]; then
echo "ERROR: working tree has uncommitted changes. commit or stash first." >&2
git status --short >&2
exit 1
fi
echo "==> Bumping to v$VERSION"
# Root package.json
node -e '
var fs=require("fs"); var f="package.json";
var p=JSON.parse(fs.readFileSync(f)); p.version=process.argv[1];
fs.writeFileSync(f, JSON.stringify(p, null, 2) + "\n");
' "$VERSION"
echo " updated package.json"
# Mobile package.json
node -e '
var fs=require("fs"); var f="mobile/package.json";
var p=JSON.parse(fs.readFileSync(f)); p.version=process.argv[1];
fs.writeFileSync(f, JSON.stringify(p, null, 2) + "\n");
' "$VERSION"
echo " updated mobile/package.json"
# Android build.gradle
# versionCode: encode X.Y.Z as X*100000 + Y*1000 + Z (room for 999 patches)
IFS='.' read -r MAJ MIN PAT <<< "$VERSION"
ANDROID_CODE=$(( MAJ * 100000 + MIN * 1000 + PAT ))
sed -i -E \
-e "s/versionCode +[0-9]+/versionCode ${ANDROID_CODE}/" \
-e "s/versionName +\"[^\"]+\"/versionName \"${VERSION}\"/" \
mobile/android/app/build.gradle
echo " updated mobile/android/app/build.gradle (code=$ANDROID_CODE, name=$VERSION)"
# Commit
git add package.json mobile/package.json mobile/android/app/build.gradle
git commit -m "Release v${VERSION}"
echo " committed"
# Tag
git tag -a "v${VERSION}" -m "Release v${VERSION}"
echo " tagged v${VERSION}"
if $PUSH; then
git push origin HEAD
git push origin "v${VERSION}"
echo " pushed to origin"
fi
if $DO_RELEASE; then
if ! command -v gh >/dev/null; then
echo "WARN: gh CLI not installed, skipping GitHub release creation" >&2
else
APK="mobile/android/app/build/outputs/apk/release/app-release.apk"
if [[ -f "$APK" ]]; then
gh release create "v${VERSION}" "$APK" \
--title "PedScribe ${VERSION}" \
--notes "Release ${VERSION}" \
--latest
echo " created GitHub release with APK"
else
gh release create "v${VERSION}" \
--title "PedScribe ${VERSION}" \
--notes "Release ${VERSION}" \
--latest
echo " created GitHub release (no APK attached — run gradle first then gh release upload)"
fi
fi
fi
echo "==> Done. v$VERSION."

View file

@ -1,4 +1,5 @@
require('dotenv').config();
const { version: APP_VERSION } = require('./package.json');
const express = require('express');
const cors = require('cors');
const helmet = require('helmet');
@ -232,7 +233,7 @@ app.get('/api/health', (req, res) => {
const { authMiddleware: _hcAuth, adminMiddleware: _hcAdmin } = require('./src/middleware/auth');
app.get('/api/health/detailed', _hcAuth, _hcAdmin, (req, res) => {
res.json({
status: 'running', version: '6.0.0', provider: activeProvider,
status: 'running', version: APP_VERSION, provider: activeProvider,
timestamp: new Date().toISOString(),
openrouter: process.env.OPENROUTER_API_KEY ? 'configured' : 'missing',
bedrock: process.env.AWS_BEDROCK_REGION ? 'configured' : 'not configured',
@ -302,7 +303,7 @@ const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log('');
console.log('==========================================');
console.log('🏥 PEDIATRIC AI SCRIBE v6.0');
console.log('🏥 PEDIATRIC AI SCRIBE v' + APP_VERSION);
console.log('==========================================');
console.log('🌐 http://localhost:' + PORT);
console.log('🤖 Provider: ' + activeProvider);