forked from serilog-contrib/serilog-sinks-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.ps1
41 lines (34 loc) · 1.07 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
echo "In directory: $PSScriptRoot"
$solution = "serilog-sinks-elasticsearch.sln"
$test = "test\\Serilog.Sinks.Elasticsearch.Tests\\Serilog.Sinks.Elasticsearch.Tests.csproj"
[string[]]$projects = @(
("src\\Serilog.Sinks.Elasticsearch\\Serilog.Sinks.Elasticsearch.csproj"),
("src\\Serilog.Formatting.Elasticsearch\\Serilog.Formatting.Elasticsearch.csproj")
)
function Invoke-Build()
{
Write-Output "Building"
if(Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
& dotnet test $test -c Release
if($LASTEXITCODE -ne 0)
{
Write-Output "The tests failed"
exit 1
}
Write-Output "Creating packages"
foreach ($project in $projects)
{
& dotnet pack $project -c Release -o ..\..\artifacts --include-symbols --include-source /p:PackageVersion=$env:GitVersion_NuGetVersionV2
}
if($LASTEXITCODE -ne 0)
{
Write-Output "Packing the sink failed"
exit 1
}
Write-Output "Building done"
}
$ErrorActionPreference = "Stop"
Invoke-Build