$version = Get-Content "$PSScriptRoot\Cargo.toml" ` | Where-Object { $_ -like "version = `"*`"" } ` | ForEach-Object { $_ -match "^version\s*=\s*`"(?[0-9\.]+)`"$" | Out-Null; $Matches.Version } if (!$version) { Write-Warning "No version found in Cargo.toml" exit 1 } $src_x86 = "$PSScriptRoot\target\i686-pc-windows-msvc\release\boom.exe" $src_x64 = "$PSScriptRoot\target\x86_64-pc-windows-msvc\release\boom.exe" if (!(Test-Path $src_x86) -or !(Test-Path $src_x64)) { Write-Warning "The compiled binaries could not be found" exit 1 } function publishToZip($src, $trg) { if (Test-Path $trg) { Remove-Item $trg } Compress-Archive -Path $src -DestinationPath $trg -CompressionLevel Optimal } $trgDir = "$PSScriptRoot\release\v${version}" mkdir -Force $trgDir | Out-Null publishToZip $src_x86 "$trgDir\boom_x86.zip" publishToZip $src_x64 "$trgDir\boom_x64.zip" $trgDir = "$PSScriptRoot\release\latest" mkdir -Force $trgDir | Out-Null publishToZip $src_x86 "$trgDir\boom_x86.zip" publishToZip $src_x64 "$trgDir\boom_x64.zip"