release: only upload artifacts matching the current version (skip stale bundles)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user