36c06b55ea
Do not inflate latest.json from dmg filenames; use build version only. Add client loop guard when the same update retries without version bump. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.7 KiB
Bash
Executable File
53 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# signed updater bundle → latest.json (deploy/checkout 후 placeholder 복구)
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH:-/usr/bin:/bin}"
|
|
UPDATES_DIR="${UPDATES_DIR:-${WORK_TREE:-$ROOT}/frontend/public/desktop/updates}"
|
|
CONF="$ROOT/desktop/src-tauri/tauri.conf.json"
|
|
BASE_URL="${DESKTOP_UPDATE_BASE_URL:-https://exdev.co.kr/desktop/updates}"
|
|
BASE_URL="${BASE_URL/http:\/\//https:\/\/}"
|
|
|
|
if [[ ! -d "$UPDATES_DIR" ]]; then
|
|
echo "[reconcile-latest] skip — no $UPDATES_DIR"
|
|
exit 0
|
|
fi
|
|
|
|
VERSION="$(node -p "require('$CONF').version" 2>/dev/null || echo '0.1.0')"
|
|
BUILD_INFO="$UPDATES_DIR/build-info.json"
|
|
if [[ -f "$BUILD_INFO" ]]; then
|
|
VERSION="$(node <<NODE
|
|
const fs = require('fs');
|
|
const cmp = (a, b) => {
|
|
const pa = a.split('.').map(Number), pb = b.split('.').map(Number);
|
|
for (let i = 0; i < 3; i++) { const d = (pa[i]||0)-(pb[i]||0); if (d) return d; }
|
|
return 0;
|
|
};
|
|
const confV = '$VERSION';
|
|
let biV = confV;
|
|
try { biV = JSON.parse(fs.readFileSync('$BUILD_INFO', 'utf8')).version || confV; } catch {}
|
|
console.log(cmp(biV, confV) > 0 ? biV : confV);
|
|
NODE
|
|
)"
|
|
fi
|
|
# dmg/exe 설치 파일명 버전은 manifest에 반영하지 않음 (updater tar.gz/exe와 불일치 시 루프 유발)
|
|
NOTES="${DESKTOP_RELEASE_NOTES:-GoldenChart Desktop $VERSION}"
|
|
|
|
set +e
|
|
node "$ROOT/scripts/generate-desktop-latest-json.mjs" \
|
|
--version "$VERSION" \
|
|
--dir "$UPDATES_DIR" \
|
|
--base-url "$BASE_URL" \
|
|
--notes "$NOTES"
|
|
RC=$?
|
|
set -e
|
|
|
|
if [[ "$RC" -eq 0 ]]; then
|
|
echo "[reconcile-latest] updated $UPDATES_DIR/latest.json"
|
|
elif [[ "$RC" -eq 2 ]]; then
|
|
echo "[reconcile-latest] no signed bundles — keeping existing latest.json"
|
|
else
|
|
exit "$RC"
|
|
fi
|