diff --git a/scripts/build-windows-installer.ts b/scripts/build-windows-installer.ts index b5067ec..bcdf9d5 100644 --- a/scripts/build-windows-installer.ts +++ b/scripts/build-windows-installer.ts @@ -97,8 +97,9 @@ async function cleanInstallerOutput(version: string): Promise { if (relative(output, root) !== '') throw new Error('The installer output directory is redirected.'); const { installer, manifest, signature } = launcherReleaseFiles(version); + const portable = `wtoffline-launcher-${version}-win-x64-portable.zip`; const legacy = `WTOffline Launcher Setup ${version}.exe`; - const names = [installer, installer + '.blockmap', legacy, legacy + '.blockmap', manifest, signature, 'win-unpacked']; + const names = [installer, installer + '.blockmap', portable, legacy, legacy + '.blockmap', manifest, signature, 'win-unpacked']; const artifacts = []; for (const name of names) { const path = join(root, name); @@ -160,6 +161,13 @@ async function main(): Promise { }, }); for (const artifact of artifacts) console.info(artifact); + const portable = join(output, `wtoffline-launcher-${manifest.version}-win-x64-portable.zip`); + const unpackedGlob = join(output, 'win-unpacked', '*'); + execFileSync('powershell.exe', [ + '-NoProfile', '-NonInteractive', '-Command', + `Compress-Archive -Path "${unpackedGlob}" -DestinationPath "${portable}" -Force`, + ], { cwd: repository, stdio: 'inherit', windowsHide: true }); + console.info(portable); } finally { const actual = await realpath(stage); if (actual === stage && dirname(actual) === temp) await rm(stage, { recursive: true, force: true });