release: merge latest.json platforms across split mac/linux releases
So a per-machine release (macOS here, Linux on Arch) of the same version keeps both platform entries instead of clobbering the one not built this run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -100,15 +100,30 @@ async function main() {
|
|||||||
for (const [key, { file, sig }] of Object.entries(updater)) {
|
for (const [key, { file, sig }] of Object.entries(updater)) {
|
||||||
platforms[key] = { signature: sig, url: dlUrl(verTag, path.basename(file)) };
|
platforms[key] = { signature: sig, url: dlUrl(verTag, path.basename(file)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge with the currently-published latest.json so a split release (e.g. macOS
|
||||||
|
// on one machine, Linux on another) doesn't drop the platform we didn't build
|
||||||
|
// this run — as long as both build the SAME version. A published older version
|
||||||
|
// is ignored (a fresh version starts clean; the other platform re-publishes).
|
||||||
|
let merged = platforms;
|
||||||
|
try {
|
||||||
|
const cur = await fetch(dlUrl(UPDATER_TAG, 'latest.json')).then((r) => (r.ok ? r.json() : null));
|
||||||
|
if (cur && cur.version === VERSION && cur.platforms) {
|
||||||
|
const kept = Object.keys(cur.platforms).filter((k) => !platforms[k]);
|
||||||
|
merged = { ...cur.platforms, ...platforms };
|
||||||
|
if (kept.length) console.log('Merged kept platforms from published latest.json:', kept.join(', '));
|
||||||
|
}
|
||||||
|
} catch { /* offline / first ever release */ }
|
||||||
|
|
||||||
const latest = {
|
const latest = {
|
||||||
version: VERSION,
|
version: VERSION,
|
||||||
notes: `X-Plane Cockpit ${verTag}`,
|
notes: `X-Plane Cockpit ${verTag}`,
|
||||||
pub_date: new Date().toISOString(),
|
pub_date: new Date().toISOString(),
|
||||||
platforms,
|
platforms: merged,
|
||||||
};
|
};
|
||||||
const latestPath = path.join(ROOT, 'desktop/latest.json');
|
const latestPath = path.join(ROOT, 'desktop/latest.json');
|
||||||
fs.writeFileSync(latestPath, JSON.stringify(latest, null, 2));
|
fs.writeFileSync(latestPath, JSON.stringify(latest, null, 2));
|
||||||
console.log('latest.json platforms:', Object.keys(platforms).join(', ') || '(none)');
|
console.log('latest.json platforms:', Object.keys(merged).join(', ') || '(none)');
|
||||||
|
|
||||||
// Upload latest.json to the fixed "updater" release (constant endpoint URL).
|
// Upload latest.json to the fixed "updater" release (constant endpoint URL).
|
||||||
const upd = await ensureRelease(UPDATER_TAG, 'Updater channel', 'Rolling pointer used by the in-app updater.');
|
const upd = await ensureRelease(UPDATER_TAG, 'Updater channel', 'Rolling pointer used by the in-app updater.');
|
||||||
|
|||||||
Reference in New Issue
Block a user