diff --git a/apps/desktop/scripts/release-codeberg.mjs b/apps/desktop/scripts/release-codeberg.mjs index b2425bdd15..4805085111 100644 --- a/apps/desktop/scripts/release-codeberg.mjs +++ b/apps/desktop/scripts/release-codeberg.mjs @@ -35,7 +35,11 @@ const distDir = join(here, "..", "dist"); const authHeaders = { Authorization: `token ${token}` }; // Channel files electron-updater needs + the installers themselves. -const WANTED = [/^latest\.yml$/, /^latest-linux\.yml$/, /\.exe$/, /\.exe\.blockmap$/, /\.AppImage$/, /\.AppImage\.blockmap$/]; +// electron-updater channel files (always the current build) — uploaded regardless. +const CHANNEL_FILES = new Set(["latest.yml", "latest-linux.yml"]); +// Installers for this version. The version filter avoids grabbing leftover +// artifacts from previous builds sitting in dist/. +const INSTALLER_EXT = /\.(exe|exe\.blockmap|deb|flatpak|pacman|tar\.gz)$/; async function api(path, init = {}) { const res = await fetch(`${API}${path}`, { ...init, headers: { ...authHeaders, ...(init.headers ?? {}) } }); @@ -61,7 +65,10 @@ async function getOrCreateRelease() { } async function main() { - const files = (await readdir(distDir)).filter((f) => WANTED.some((re) => re.test(f))); + const version = pkg.version; + const files = (await readdir(distDir)).filter( + (f) => CHANNEL_FILES.has(f) || (f.includes(version) && INSTALLER_EXT.test(f)), + ); if (files.length === 0) { console.error(`No matching artifacts in ${distDir}. Run \`pnpm run build\` first.`); process.exit(1);