버전문제 수정

This commit is contained in:
Macbook
2026-06-15 00:03:05 +09:00
parent 55a517ba1c
commit d8529ed582
7 changed files with 90 additions and 27 deletions
+17 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# published latest.json·설치 파일·tauri.conf 중 최대 버전 +1 patch → tauri.conf.json
# published latest.json(로컬·원격)·설치 파일·tauri.conf 중 최대 +1 patch
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
@@ -10,6 +10,16 @@ UPDATES_DIR="${WORK_TREE}/frontend/public/desktop/updates"
BUILD_INFO="${WORK_TREE}/dist-desktop/build-info.json"
RELEASE_DIR="${GC_DESKTOP_APP_RELEASE_DIR:-$WORK_TREE/data/desktop-releases}"
PUBLISHED_LATEST_URL="${DESKTOP_PUBLISHED_LATEST_URL:-${DESKTOP_UPDATE_BASE_URL:-https://exdev.co.kr/desktop/updates}/latest.json}"
REMOTE_PUB_VER=""
if REMOTE_JSON="$(curl -sf --connect-timeout 5 --max-time 12 "$PUBLISHED_LATEST_URL" 2>/dev/null)"; then
REMOTE_PUB_VER="$(printf '%s' "$REMOTE_JSON" | node -e "
let d=''; process.stdin.on('data',c=>d+=c);
process.stdin.on('end',()=>{ try { console.log(JSON.parse(d).version||''); } catch { console.log(''); } });
" 2>/dev/null || true)"
[[ -n "$REMOTE_PUB_VER" ]] && echo "[bump-desktop] remote latest.json → v${REMOTE_PUB_VER} (${PUBLISHED_LATEST_URL})" >&2
fi
node -e "
const fs = require('fs');
const path = require('path');
@@ -18,6 +28,7 @@ const latestPath = process.argv[2];
const updatesDir = process.argv[3];
const buildInfoPath = process.argv[4];
const releaseDir = process.argv[5];
const remotePub = process.argv[6] || '';
const parse = v => String(v || '0.0.0').trim().replace(/^v/i, '').split('.').map(n => parseInt(n, 10) || 0);
const cmp = (a, b) => {
@@ -29,11 +40,13 @@ const cmp = (a, b) => {
}
return 0;
};
const maxVer = (cur, next) => (cmp(next, cur) > 0 ? next : cur);
const maxVer = (cur, next) => (next && cmp(next, cur) > 0 ? next : cur);
const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
let base = conf.version || '0.1.0';
if (remotePub) base = maxVer(base, remotePub);
if (fs.existsSync(latestPath)) {
try {
const pub = JSON.parse(fs.readFileSync(latestPath, 'utf8'));
@@ -67,6 +80,7 @@ const parts = parse(base);
while (parts.length < 3) parts.push(0);
parts[2] += 1;
const nv = parts.join('.');
console.error('[bump-desktop] max base v' + base + ' → v' + nv);
conf.version = nv;
fs.writeFileSync(confPath, JSON.stringify(conf, null, 2) + '\n');
const pkgPath = path.join(path.dirname(confPath), '..', 'package.json');
@@ -76,4 +90,4 @@ try {
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
} catch { /* ignore */ }
console.log(nv);
" "$CONF" "$LATEST" "$UPDATES_DIR" "$BUILD_INFO" "$RELEASE_DIR"
" "$CONF" "$LATEST" "$UPDATES_DIR" "$BUILD_INFO" "$RELEASE_DIR" "$REMOTE_PUB_VER"