forked from TestableIO/System.IO.Abstractions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPublish-Release.ps1
More file actions
48 lines (40 loc) · 1.35 KB
/
Copy pathPublish-Release.ps1
File metadata and controls
48 lines (40 loc) · 1.35 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
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
$NuGetExe = Join-Path $SolutionRoot -ChildPath ".nuget/nuget.exe"
# Build the NuGet package
$ProjectPath = Join-Path -Path $SolutionRoot -ChildPath "System.IO.Abstractions\System.IO.Abstractions.csproj"
& $NuGetExe pack $ProjectPath -Prop Configuration=Release -OutputDirectory $SolutionRoot
if (-not $?)
{
throw "The NuGet process returned an error code."
}
$ProjectPath = Join-Path -Path $SolutionRoot -ChildPath "TestingHelpers\TestingHelpers.csproj"
& $NuGetExe 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 "System.IO.Abstractions.$ReleaseVersionNumber.nupkg"
& $NuGetExe push $NuPkgPath
if (-not $?)
{
throw "The NuGet process returned an error code."
}
$NuPkgPath = Join-Path -Path $SolutionRoot -ChildPath "System.IO.Abstractions.TestingHelpers.$ReleaseVersionNumber.nupkg"
& $NuGetExe push $NuPkgPath
if (-not $?)
{
throw "The NuGet process returned an error code."
}
}