forked from pester/Pester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildNugetPackage.ps1
34 lines (28 loc) · 965 Bytes
/
buildNugetPackage.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
$VerbosePreference = 'Continue'
$ErrorActionPreference = 'Stop'
try
{
$baseDir = $PSScriptRoot
$buildDir = "$baseDir\build\nuget"
$nugetExe = "$baseDir\vendor\tools\nuget.exe"
$targetBase = "tools"
Write-Verbose "Running in $baseDir"
Write-Verbose "Building to $buildDir"
$version = git.exe describe --abbrev=0 --tags
Write-Verbose "Version $version"
if (Test-Path $buildDir) {
Write-Verbose "Removing build dir"
Remove-Item $buildDir -Recurse -Force -Confirm:$false -Verbose
}
Write-Verbose "Removing all Test Files"
Get-ChildItem $baseDir -Recurse -Filter *.Tests.ps1 | Remove-Item -Force -Verbose
Write-Verbose "Creating $buildDir"
mkdir $buildDir
Write-Verbose "Building package"
&$nugetExe pack "$baseDir\Pester.nuspec" -OutputDirectory $buildDir -NoPackageAnalysis -version $version -Properties targetBase=$targetBase
}
catch
{
Write-Error -ErrorRecord $_
exit 1
}