This repository has been archived by the owner on Sep 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.ps1
73 lines (55 loc) · 1.77 KB
/
build.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Framework "4.6"
properties {
$path = "src\RampUp.sln"
}
function Get-Version {
return (cat .specs\Version.txt)
}
Task Compile -Depends Clear, Restore {
exec {msbuild $path /t:Rebuild /p:Configuration=Release /verbosity:normal /m /nr:false}
if ($lastexitcode -ne 0) {
throw "Build failed"
}
}
Task default -Depends Compile, Tests
Task Restore {
exec {.tools\nuget\NuGet.exe restore $path}
}
Task Clear {
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) {
remove-item $_.fullname -Force -Recurse
}
Remove-Item *.nupkg
Remove-Item *TestResult.xml
Remove-Item *_temp.nuspec
}
Task Tests {
src\packages\NUnit.Runners.2.6.4\tools\nunit-console.exe src\RampUp.Tests\bin\Release\RampUp.Tests.dll /exclude:CodeCop /result:TestResult.xml /framework:net-4.6.1
if ($lastexitcode -ne 0) {
throw "Tests failed"
}
}
Task Pack {
$major_minor = Get-Version
$version = $major_minor + "." + $buildNo + "-prerelease"
Get-ChildItem .\.specs -Filter *.nuspec | foreach ($_) {
$tempFileName = $_.name + "_temp.nuspec"
Copy-Item $_.fullname $tempFileName
$tempFile = gi $tempFileName
[xml] $spec = gc $tempFileName
$spec.package.metadata.version = $version
# $spec.package.metadata.tags = $tags
Write-Host $tempFile
$spec.Save($tempFile.FullName)
# run packaging
exec { .tools\nuget\NuGet.exe pack $tempFile.FullName -Verbosity normal -NoPackageAnalysis }
# remove temp nuspec
ri $tempFile.FullName
}
}
Task Push {
Get-ChildItem . -Filter *.nupkg | foreach ($_) {
exec { .tools\nuget\NuGet.exe push $_.fullname -Source $nugetSource -ApiKey $nugetApiKey }
Remove-Item $_.fullname
}
}