# Runs inside the repomon windows-build job (see .repomon/release.toml).
# Builds the native x86_64-pc-windows-msvc binary and packages it exactly
# like the old (GitHub Actions) release.yml's Windows packaging step did: a
# single-binary zip named cargo-matrix-<target>-v<version>.zip.
$ErrorActionPreference = "Stop"
$t = "x86_64-pc-windows-msvc"
$version = (git describe --tags --exact-match) -replace '^v', ''
cargo build --release --locked --target $t
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Copy-Item "target\$t\release\cargo-matrix.exe" "cargo-matrix.exe"
Compress-Archive -Path cargo-matrix.exe -DestinationPath "cargo-matrix-$t-v$version.zip"
Remove-Item cargo-matrix.exe