forked from lurumad/serilog-sinks-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.ps1
More file actions
51 lines (41 loc) · 1.19 KB
/
Build.ps1
File metadata and controls
51 lines (41 loc) · 1.19 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
49
50
51
$solution = "$project.sln"
$test = "test\\Serilog.Sinks.Elasticsearch.Tests\\project.json"
$projectFolder = "src\\Serilog.Sinks.Elasticsearch"
$project = $projectFolder + "\\project.json"
function Invoke-Build()
{
Write-Output "Building"
if(Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
& dotnet restore $test --verbosity Warning
& dotnet restore $project --verbosity Warning
# calculate version, only when on a branch
if ($(git log -n 1 --pretty=%d HEAD).Trim() -ne '(HEAD)')
{
Write-Output "Determining version number using gitversion"
& cd $projectFolder
& dotnet gitversion --verbosity Warning
& cd "..\\.."
}
else
{
Write-Output "In a detached HEAD mode, unable to determine the version number using gitversion"
}
& dotnet test $test -c Release
if($LASTEXITCODE -ne 0)
{
Write-Output "The tests failed"
exit 1
}
& dotnet pack $project -c Release -o .\artifacts
if($LASTEXITCODE -ne 0)
{
Write-Output "Packing the sink failed"
exit 1
}
Write-Output "Building done"
}
$ErrorActionPreference = "Stop"
Invoke-Build