24 lines
1.5 KiB
PowerShell
24 lines
1.5 KiB
PowerShell
param([switch]$PublishRelease)
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = $PSScriptRoot
|
|
$destination = Join-Path $root 'dist\KSwitcher'
|
|
New-Item -ItemType Directory -Force $destination | Out-Null
|
|
Copy-Item -LiteralPath (Join-Path $root 'build\release\KSwitcher.exe') -Destination $destination
|
|
Copy-Item -LiteralPath (Join-Path $root 'LICENSE') -Destination $destination
|
|
Copy-Item -LiteralPath (Join-Path $root 'vendor\json-LICENSE.txt') -Destination $destination
|
|
Copy-Item -LiteralPath (Join-Path $root 'README.md') -Destination $destination
|
|
Copy-Item -LiteralPath (Join-Path $root 'dictionaries') -Destination $destination -Recurse -Force
|
|
# Enumerate the distributable files explicitly; do not include a user's data directory.
|
|
$files = @('KSwitcher.exe','LICENSE','json-LICENSE.txt','README.md','dictionaries') | ForEach-Object { Join-Path $destination $_ }
|
|
$archive = Join-Path $root 'dist\KSwitcher-win-x64.zip'
|
|
Compress-Archive -LiteralPath $files -DestinationPath $archive -Force
|
|
Get-FileHash -LiteralPath $archive -Algorithm SHA256
|
|
if ($PublishRelease) {
|
|
$release = Join-Path $root 'Release'
|
|
New-Item -ItemType Directory -Force $release | Out-Null
|
|
$published = Join-Path $release 'KSwitcher-win-x64.zip'
|
|
Copy-Item -LiteralPath $archive -Destination $published -Force
|
|
$hash = (Get-FileHash -LiteralPath $published -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
"$hash KSwitcher-win-x64.zip" | Set-Content -LiteralPath (Join-Path $release 'SHA256SUMS.txt') -Encoding ascii
|
|
}
|