From 967df18287b8b7e2fc016a51e2202dfec3a4b122 Mon Sep 17 00:00:00 2001 From: Macbook Date: Sun, 14 Jun 2026 12:03:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Windows=20desktop=20updater=20=E2=80=94?= =?UTF-8?q?=20sign=20setup.exe,=20preserve=20latest.json=20on=20deploy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sign *-setup.exe for updater manifest, pick newest bundle per platform, reconcile after git checkout, and stop overwriting latest.json with empty placeholder. Bump desktop to 0.1.3. Co-authored-by: Cursor --- desktop/package.json | 2 +- desktop/src-tauri/tauri.conf.json | 2 +- scripts/deploy.sh | 7 +++++++ scripts/generate-desktop-latest-json.mjs | 25 ++++++++++++++++++++++-- scripts/publish-desktop-update.sh | 12 ++---------- scripts/reconcile-desktop-latest-json.sh | 23 +++++++++++++++++++++- 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/desktop/package.json b/desktop/package.json index 86bf0b4..1b2f092 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@goldenchart/desktop", - "version": "0.1.2", + "version": "0.1.3", "private": true, "type": "module", "scripts": { diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json index 1871083..6e7a44e 100644 --- a/desktop/src-tauri/tauri.conf.json +++ b/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "GoldenChart", - "version": "0.1.2", + "version": "0.1.3", "identifier": "com.goldenchart.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 12d2739..294857b 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -73,6 +73,13 @@ fi [ ! -f "$DOCKER_COMPOSE_FILE" ] && err "docker-compose.yml 없음: $DOCKER_COMPOSE_FILE" cd "$WORK_TREE" +# Phase 1b — git checkout이 placeholder latest.json 을 되돌리므로 signed bundle 기준 복구 +RECONCILE="$WORK_TREE/scripts/reconcile-desktop-latest-json.sh" +if [[ -x "$RECONCILE" ]]; then + info "[Phase 1b] desktop latest.json reconcile" + WORK_TREE="$WORK_TREE" "$RECONCILE" || warn "reconcile-desktop-latest-json 실패" +fi + # Phase 2 — Docker 이미지 빌드 (호스트 npm 사용 안 함 → postcss 홈 디렉터리 간섭 방지) info "[Phase 2] Docker 이미지 빌드 ($SERVICE_NAME)" diff --git a/scripts/generate-desktop-latest-json.mjs b/scripts/generate-desktop-latest-json.mjs index f2606d5..452b25e 100644 --- a/scripts/generate-desktop-latest-json.mjs +++ b/scripts/generate-desktop-latest-json.mjs @@ -29,7 +29,22 @@ if (!fs.existsSync(dir)) { const files = fs.readdirSync(dir); -/** @type {Record} */ +function versionFromName(name) { + const m = name.match(/(\d+\.\d+\.\d+)/); + return m ? m[1] : '0.0.0'; +} + +function cmpSemver(a, b) { + const pa = a.split('.').map(Number); + const pb = b.split('.').map(Number); + for (let i = 0; i < 3; i++) { + const d = (pa[i] || 0) - (pb[i] || 0); + if (d !== 0) return d; + } + return 0; +} + +/** @type {Record} */ const platforms = {}; function addPlatform(platformKey, bundleName) { @@ -43,9 +58,13 @@ function addPlatform(platformKey, bundleName) { console.warn(`[warn] missing signature: ${sigPath}`); return; } + const bundleVersion = versionFromName(bundleName); + const existing = platforms[platformKey]; + if (existing && cmpSemver(bundleVersion, existing.bundleVersion) <= 0) return; platforms[platformKey] = { url: `${baseUrl}/${encodeURIComponent(bundleName)}`, signature, + bundleVersion, }; } @@ -72,7 +91,9 @@ const manifest = { version, notes, pub_date: new Date().toISOString(), - platforms, + platforms: Object.fromEntries( + Object.entries(platforms).map(([k, v]) => [k, { url: v.url, signature: v.signature }]), + ), }; const outPath = path.join(dir, 'latest.json'); diff --git a/scripts/publish-desktop-update.sh b/scripts/publish-desktop-update.sh index 57971d1..4575c9b 100755 --- a/scripts/publish-desktop-update.sh +++ b/scripts/publish-desktop-update.sh @@ -48,7 +48,7 @@ fi # updater 번들 서명 if [[ -f "$KEY_PATH" ]]; then shopt -s nullglob - for bundle in "$PUBLISH_UPDATES"/*.tar.gz "$PUBLISH_UPDATES"/*.nsis.zip "$PUBLISH_UPDATES"/*.zip; do + for bundle in "$PUBLISH_UPDATES"/*.tar.gz "$PUBLISH_UPDATES"/*-setup.exe "$PUBLISH_UPDATES"/*.nsis.zip "$PUBLISH_UPDATES"/*.zip; do [[ -f "$bundle" ]] || continue [[ "$bundle" == *.sig ]] && continue log "Signing $(basename "$bundle")" @@ -77,15 +77,7 @@ GEN_RC=$? set -e if [[ "$GEN_RC" -eq 2 ]]; then - log "[WARN] signed updater bundle 없음 — placeholder latest.json 작성" - cat > "$PUBLISH_UPDATES/latest.json" </dev/null || echo '0.1.0')" LATEST_JSON="$UPDATES_DIR/latest.json" +BUILD_INFO="$UPDATES_DIR/build-info.json" +if [[ -f "$BUILD_INFO" ]]; then + BI_VER="$(node -p "require('$BUILD_INFO').version || ''" 2>/dev/null || true)" + if [[ -n "$BI_VER" ]]; then + VERSION="$(node < { + 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; +}; +console.log(cmp('$BI_VER', '$VERSION') > 0 ? '$BI_VER' : '$VERSION'); +NODE +)" + fi +fi if [[ -f "$LATEST_JSON" ]]; then EXISTING="$(node < 0; +} catch {} +if (!hasPlatforms) { console.log(confV); process.exit(0); } const cmp = (a, b) => { const pa = a.split('.').map(Number), pb = b.split('.').map(Number); for (let i = 0; i < 3; i++) {