-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
release-build.ps1
29 lines (18 loc) · 1.31 KB
/
release-build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Requires -Version 7
Push-Location $PSScriptRoot
New-Item -ItemType Directory -Force -Path "$PSScriptRoot\dist" | Out-Null
Remove-Item "$PSScriptRoot\dist\*" -Recurse -Force
Write-Host 'Compiling...' -ForegroundColor DarkCyan
dotnet build --configuration Release
Copy-Item -Path "$PSScriptRoot\src\bin\Release\net45\shim.exe" -Destination "$PSScriptRoot\dist" -Force
Write-Host 'Computing checksums...' -ForegroundColor DarkCyan
Get-ChildItem "$PSScriptRoot\dist\*" -Include *.exe | ForEach-Object {
"$((Get-FileHash -Path $_ -Algorithm SHA256).Hash.ToLower()) *$($_.Name)" | Out-File "$PSScriptRoot\dist\checksum.sha256" -Append -Encoding utf8
"$((Get-FileHash -Path $_ -Algorithm SHA512).Hash.ToLower()) *$($_.Name)" | Out-File "$PSScriptRoot\dist\checksum.sha512" -Append -Encoding utf8
}
Write-Host 'Packaging...' -ForegroundColor DarkCyan
$version = ([xml](Get-Content "$PSScriptRoot\src\shim.csproj")).Project.PropertyGroup.Version
"$version" | Out-File "$PSScriptRoot\dist\version.txt" -Encoding utf8
Compress-Archive -Path "$PSScriptRoot\dist\*" -DestinationPath "$PSScriptRoot\dist\shim-$version.zip"
"$((Get-FileHash -Path "$PSScriptRoot\dist\shim-$version.zip" -Algorithm SHA256).Hash.ToLower()) *$("shim-$version.zip")" | Out-File "$PSScriptRoot\dist\shim-$version.zip.sha256" -Append -Encoding utf8
Pop-Location