fix: Mac desktop updater — platform-aware errors, HTTPS latest.json
Show Mac-specific update errors on macOS (not Windows message). Force HTTPS bundle URLs, fix reconcile version from bundle filenames, bump to 0.1.4. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,7 +19,8 @@ function arg(name, fallback) {
|
||||
|
||||
const version = arg('--version', '0.1.0');
|
||||
const dir = path.resolve(arg('--dir', 'dist-desktop/updates'));
|
||||
const baseUrl = (arg('--base-url', 'https://exdev.co.kr/desktop/updates')).replace(/\/$/, '');
|
||||
const rawBaseUrl = arg('--base-url', 'https://exdev.co.kr/desktop/updates');
|
||||
const baseUrl = rawBaseUrl.replace(/\/$/, '').replace(/^http:\/\//i, 'https://');
|
||||
const notes = arg('--notes', `GoldenChart Desktop ${version}`);
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
@@ -82,13 +83,18 @@ for (const f of files) {
|
||||
} else if (lower.endsWith('-setup.exe') || (lower.includes('setup') && lower.endsWith('.exe'))) {
|
||||
addPlatform('windows-x86_64', f);
|
||||
} else if (lower.endsWith('.app.tar.gz')) {
|
||||
// universal mac fallback
|
||||
if (!platforms['darwin-aarch64']) addPlatform('darwin-aarch64', f);
|
||||
addPlatform('darwin-aarch64', f);
|
||||
}
|
||||
}
|
||||
|
||||
const bundleMaxVersion = Object.values(platforms).reduce(
|
||||
(max, p) => (cmpSemver(p.bundleVersion, max) > 0 ? p.bundleVersion : max),
|
||||
'0.0.0',
|
||||
);
|
||||
const manifestVersion = cmpSemver(bundleMaxVersion, version) > 0 ? bundleMaxVersion : version;
|
||||
|
||||
const manifest = {
|
||||
version,
|
||||
version: manifestVersion,
|
||||
notes,
|
||||
pub_date: new Date().toISOString(),
|
||||
platforms: Object.fromEntries(
|
||||
|
||||
@@ -8,6 +8,7 @@ UPDATES_SRC="${UPDATES_SRC:-$ARTIFACT_DIR/updates}"
|
||||
UPDATES_DIR="${UPDATES_DIR:-${WORK_TREE:-$ROOT}/frontend/public/desktop/updates}"
|
||||
WEB_STATIC_DIR="${WEB_STATIC_DIR:-$UPDATES_DIR}"
|
||||
BASE_URL="${DESKTOP_UPDATE_BASE_URL:-https://exdev.co.kr/desktop/updates}"
|
||||
BASE_URL="${BASE_URL/http:\/\//https:\/\/}"
|
||||
DESKTOP_RELEASE_DIR="${GC_DESKTOP_APP_RELEASE_DIR:-$ROOT/data/desktop-releases}"
|
||||
KEY_PATH="${TAURI_SIGNER_KEY:-$HOME/.tauri/goldenchart.key}"
|
||||
DESKTOP_DIR="$ROOT/desktop"
|
||||
@@ -64,6 +65,11 @@ fi
|
||||
# build-info 복사
|
||||
if [[ -f "$BUILD_INFO" ]]; then
|
||||
cp -f "$BUILD_INFO" "$PUBLISH_UPDATES/build-info.json"
|
||||
node -e "
|
||||
const fs=require('fs'); const p=process.argv[1]; const v=process.argv[2];
|
||||
const j=JSON.parse(fs.readFileSync(p,'utf8')); j.version=v;
|
||||
fs.writeFileSync(p, JSON.stringify(j,null,2)+'\n');
|
||||
" "$PUBLISH_UPDATES/build-info.json" "$VERSION"
|
||||
fi
|
||||
|
||||
# latest.json
|
||||
|
||||
@@ -7,6 +7,7 @@ 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"
|
||||
@@ -16,45 +17,38 @@ fi
|
||||
VERSION="$(node -p "require('$CONF').version" 2>/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 <<NODE
|
||||
|
||||
# bundle 파일명·build-info·기존 manifest 중 최고 버전 사용 (build-info stale 방지)
|
||||
VERSION="$(node <<NODE
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
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;
|
||||
};
|
||||
console.log(cmp('$BI_VER', '$VERSION') > 0 ? '$BI_VER' : '$VERSION');
|
||||
NODE
|
||||
)"
|
||||
fi
|
||||
fi
|
||||
if [[ -f "$LATEST_JSON" ]]; then
|
||||
EXISTING="$(node <<NODE
|
||||
const fs = require('fs');
|
||||
const confV = '$VERSION';
|
||||
let existing = '0.0.0';
|
||||
let hasPlatforms = false;
|
||||
const maxV = (a, b) => (cmp(a, b) >= 0 ? a : b);
|
||||
let version = '$VERSION';
|
||||
const dir = '$UPDATES_DIR';
|
||||
try {
|
||||
const bi = JSON.parse(fs.readFileSync('$BUILD_INFO', 'utf8'));
|
||||
if (bi.version) version = maxV(version, bi.version);
|
||||
} catch {}
|
||||
try {
|
||||
const j = JSON.parse(fs.readFileSync('$LATEST_JSON', 'utf8'));
|
||||
existing = j.version || '0.0.0';
|
||||
hasPlatforms = j.platforms && Object.keys(j.platforms).length > 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++) {
|
||||
const d = (pa[i] || 0) - (pb[i] || 0);
|
||||
if (d !== 0) return d;
|
||||
if (j.version && j.platforms && Object.keys(j.platforms).length > 0) {
|
||||
version = maxV(version, j.version);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
console.log(cmp(existing, confV) > 0 ? existing : confV);
|
||||
} catch {}
|
||||
try {
|
||||
for (const f of fs.readdirSync(dir)) {
|
||||
const m = f.match(/(\\d+\\.\\d+\\.\\d+)/);
|
||||
if (m) version = maxV(version, m[1]);
|
||||
}
|
||||
} catch {}
|
||||
console.log(version);
|
||||
NODE
|
||||
)"
|
||||
VERSION="$EXISTING"
|
||||
fi
|
||||
NOTES="${DESKTOP_RELEASE_NOTES:-GoldenChart Desktop $VERSION}"
|
||||
|
||||
set +e
|
||||
|
||||
Reference in New Issue
Block a user