From 4a71e5f03d528499c10a03c4573da1539db73bc9 Mon Sep 17 00:00:00 2001 From: karim Date: Tue, 2 Jun 2026 16:16:43 +0200 Subject: [PATCH] release: only upload artifacts matching the current version (skip stale bundles) Co-Authored-By: Claude Opus 4.8 --- scripts/release-gitea.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/release-gitea.mjs b/scripts/release-gitea.mjs index 54e8bf3..475cada 100644 --- a/scripts/release-gitea.mjs +++ b/scripts/release-gitea.mjs @@ -40,7 +40,12 @@ function findArtifacts() { if (fs.existsSync(sig)) out.updater[platformKey] = { file, sig: fs.readFileSync(sig, 'utf8').trim() }; } }; - const glob1 = (dir, re) => fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => re.test(f)).map((f) => path.join(dir, f)) : []; + // Guard against stale bundles from older builds lingering in the output dirs: + // any artifact whose filename carries a version must match the current one. + // (The .app.tar.gz has no version in its name, so it's always accepted.) + const verRe = new RegExp(`_${VERSION.replace(/\./g, '\\.')}_`); + const verOk = (f) => !/_\d+\.\d+\.\d+_/.test(path.basename(f)) || verRe.test(path.basename(f)); + const glob1 = (dir, re) => fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => re.test(f)).map((f) => path.join(dir, f)).filter(verOk) : []; // macOS glob1(path.join(macBundle, 'macos'), /\.app\.tar\.gz$/).forEach((f) => add(f, 'darwin-aarch64')); glob1(path.join(macBundle, 'dmg'), /\.dmg$/).forEach((f) => out.assets.push(f));