forked from tathamoddie/reliability-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPublish-Release.ps1
More file actions
33 lines (27 loc) · 862 Bytes
/
Publish-Release.ps1
File metadata and controls
33 lines (27 loc) · 862 Bytes
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
param (
[Parameter(Mandatory=$true)]
[ValidatePattern("\d\.\d\.\d\.\d")]
[string]
$ReleaseVersionNumber,
[switch]$Push
)
$ErrorActionPreference = "Stop"
$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName
$SolutionRoot = Split-Path -Path $PSScriptFilePath -Parent
# Build the NuGet package
$ProjectPath = Join-Path -Path $SolutionRoot -ChildPath "ReliabilityPatterns\ReliabilityPatterns.csproj"
& nuget.exe pack $ProjectPath -Prop Configuration=Release -OutputDirectory $SolutionRoot
if (-not $?)
{
throw "The NuGet process returned an error code."
}
# Upload the NuGet package
if ($Push)
{
$NuPkgPath = Join-Path -Path $SolutionRoot -ChildPath "ReliabilityPatterns.$ReleaseVersionNumber.nupkg"
& nuget.exe push $NuPkgPath
if (-not $?)
{
throw "The NuGet process returned an error code."
}
}