diff --git a/release.js b/release.js index 391cfeb..742c7ea 100644 --- a/release.js +++ b/release.js @@ -158,13 +158,21 @@ async function main() { await ensureWebView2Loader(); + const bundleDir = path.join(__dirname, 'src-tauri', 'target', 'release', 'bundle'); + if (fs.existsSync(bundleDir)) { + fs.rmSync(bundleDir, { recursive: true, force: true }); + } + + console.log('Compiling Windows Tauri installer locally...'); execSync('npm run build', { stdio: 'inherit' }); const nsisDir = path.join(__dirname, 'src-tauri/target/release/bundle/nsis'); if (fs.existsSync(nsisDir)) { - const files = fs.readdirSync(nsisDir).filter(f => f.endsWith('.exe')); + const targetVersion = version.startsWith('v') ? version.substring(1) : version; + const files = fs.readdirSync(nsisDir).filter(f => f.endsWith('.exe') && f.includes(targetVersion)); + if (files.length > 0) { const originalName = files[0]; installerPath = path.join(nsisDir, originalName);