30 lines
975 B
Bash
Executable File
30 lines
975 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# published latest.json 기준 patch 버전 bump → tauri.conf.json (CI 자동 업데이트용)
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
WORK_TREE="${WORK_TREE:-$ROOT}"
|
|
CONF="${WORK_TREE}/desktop/src-tauri/tauri.conf.json"
|
|
LATEST="${WORK_TREE}/frontend/public/desktop/updates/latest.json"
|
|
|
|
node -e "
|
|
const fs = require('fs');
|
|
const confPath = process.argv[1];
|
|
const latestPath = process.argv[2];
|
|
const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
|
|
let base = conf.version || '0.1.0';
|
|
if (fs.existsSync(latestPath)) {
|
|
try {
|
|
const pub = JSON.parse(fs.readFileSync(latestPath, 'utf8'));
|
|
if (pub.version) base = pub.version;
|
|
} catch { /* ignore */ }
|
|
}
|
|
const parts = base.split('.').map(n => parseInt(n, 10) || 0);
|
|
while (parts.length < 3) parts.push(0);
|
|
parts[2] += 1;
|
|
const nv = parts.join('.');
|
|
conf.version = nv;
|
|
fs.writeFileSync(confPath, JSON.stringify(conf, null, 2) + '\n');
|
|
console.log(nv);
|
|
" "$CONF" "$LATEST"
|