-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublishrelease.ps1
More file actions
71 lines (56 loc) · 2.31 KB
/
publishrelease.ps1
File metadata and controls
71 lines (56 loc) · 2.31 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#Requires -Version 7.2
param (
[string]$targetplatform = "x64",
[string]$sign
)
if ($args.Count) { throw "Unexpected arguments passed: $args" }
$PSNativeCommandUseErrorActionPreference = $true
$ErrorActionPreference = "Stop"
Set-StrictMode -version 2
$startworkinglocation = Get-Location
# If -sign commandline argument was passed, run the VS Dev Shell script so signtool.exe is in the PATH
if ($sign -ne "" -and $sign -ne $null)
{
$initvsdevshell = & "$PSScriptRoot\tools\vswhere.exe" -latest -find **\Launch-VsDevShell.ps1 | select-object -first 1
if ([string]::IsNullOrEmpty($initvsdevshell) -eq $false)
{
& $initvsdevshell
}
else
{
Write-Output 'Visual Studio was not found - VS developer shell launch script was not run.'
}
$requiredexecutables = @("msbuild.exe", "signtool.exe")
foreach ($required in $requiredexecutables)
{
Write-Host Searching for $required in PATH.
if ($null -eq (Get-Command "$required" -ErrorAction SilentlyContinue))
{
Write-Host "$required not found in PATH. Exiting."
exit 1
}
Write-Host $required found.
}
$buildoutputpath = "$PSScriptRoot\publish\$targetplatform\signed"
}
else {
$buildoutputpath = "$PSScriptRoot\publish\$targetplatform\unsigned"
}
Set-Location -Path $PSScriptRoot
# Remove old stuff
Remove-Item -path $buildoutputpath -recurse -ErrorAction SilentlyContinue
mkdir -p $buildoutputpath | Out-Null
dotnet clean --configuration Release -p:Platform=$targetplatform
dotnet build -p:Configuration=Release -p:Platform=$targetplatform -p:OutputPath="$buildoutputpath" sqlclinstaller.sln
# sign the installer if -sign was specified
if ($sign -ne "" -and $sign -ne $null)
{
signtool.exe sign /sha1 $sign /t http://time.certum.pl /fd sha256 /v "$buildoutputpath\$((Get-Culture).Name)\*.msi"
}
Set-Location -Path "$buildoutputpath\$((Get-Culture).Name)\"
# compute hashes of the output
$outputfiles = Get-ChildItem "."
foreach ($outfile in $outputfiles) {
certutil -hashfile $outfile.Name sha256 | Out-File -Encoding utf8NoBOM -FilePath "$outfile.sha256"
}
Set-Location -Path $startworkinglocation