forked from stavroskasidis/BlazorWithIdentity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.ps1
49 lines (42 loc) · 1.23 KB
/
pack.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
param(
[string] $VersionSuffix
)
Push-Location $PSScriptRoot
function Write-Message{
param([string]$message)
Write-Host
Write-Host $message
Write-Host
}
function Confirm-PreviousCommand {
param([string]$errorMessage)
if ( $LASTEXITCODE -ne 0) {
if( $errorMessage) {
Write-Message $errorMessage
}
exit $LASTEXITCODE
}
}
function Confirm-Process {
param ([System.Diagnostics.Process]$process,[string]$errorMessage)
$process.WaitForExit()
if($process.ExitCode -ne 0){
Write-Host $process.ExitCode
if( $errorMessage) {
Write-Message $errorMessage
}
exit $process.ExitCode
}
}
Write-Host "Parameters"
Write-Host "=========="
Write-Host "Version suffix: $VersionSuffix"
# Check prerequisites
$proc = Start-Process "dotnet" -ArgumentList "--version" -PassThru
Confirm-Process $proc "Could not find dotnet sdk, please install and run again ..."
Write-Message "Cleaning artifacts folder"
Remove-Item -Path artifacts/*.nupkg -Recurse
Write-Message "Packing ..."
dotnet pack templatepack.csproj -c Release -o artifacts /p:VersionSuffix="$VersionSuffix"
Confirm-PreviousCommand
Write-Message "Pack completed successfully"