-
Notifications
You must be signed in to change notification settings - Fork 1
/
.build.ps1
35 lines (29 loc) · 918 Bytes
/
.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
$artifactsDir = "$PSScriptRoot\artifacts"
$version = if ($env:APPVEYOR) { $env:APPVEYOR_BUILD_VERSION } else { "1.0.0-pre" }
task Clean {
if (Test-Path $artifactsDir) { del $artifactsDir -Recurse -Force }
del * -Include bin, obj -Recurse -Force
}
task RestoreDependencies Clean, {
exec { dotnet restore /p:Version=$version }
}
task BuildSolution RestoreDependencies, {
dir *.sln | %{
exec { dotnet build $_.FullName -c Release /p:Version=$version }
}
}
task RunTests BuildSolution, {
if (Test-Path test) {
dir test -Include *.csproj -Recurse | %{
exec { dotnet test $_.FullName -c Release --no-build }
}
}
}
task PackSolution RunTests, {
if (Test-Path src) {
dir src -Include *.csproj -Recurse | %{
exec { dotnet pack $_.FullName -c Release -o $artifactsDir --no-build /p:Version=$version }
}
}
}
task . PackSolution