# Builds the release artefacts for the current platform (Windows): # target/release/am.exe -> dist/am-windows-x86_64.zip # Also prints the sha256 of every archive (for the packaging manifests). param([switch]$NoTest) $ErrorActionPreference = "Stop" cargo build --release --locked if (-not $NoTest) { cargo test --release --locked } New-Item -ItemType Directory -Force dist | Out-Null $zip = "dist/am-windows-x86_64.zip" Remove-Item $zip -ErrorAction SilentlyContinue Compress-Archive -Path target/release/am.exe -DestinationPath $zip function Get-Sha256Net([string]$path) { $stream = [System.IO.File]::OpenRead($path) try { $sha = [System.Security.Cryptography.SHA256]::Create() $bytes = $sha.ComputeHash($stream) return ([BitConverter]::ToString($bytes) -replace '-', '').ToLower() } finally { $stream.Close() } } Write-Host "" Write-Host "Artefacts:" Get-ChildItem dist -File | ForEach-Object { $hash = Get-Sha256Net $_.FullName Write-Host (" {0,-32} {1} sha256:{2}" -f $_.Name, $_.Length, $hash) }