forked from 2020Legal/NLog.Targets.Gelf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
54 lines (41 loc) · 1.52 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
properties {
$ProductName = "NLog.Targets.Gelf"
$BaseDir = Resolve-Path "."
$SolutionFile = "$BaseDir\NLog.Targets.Gelf.sln"
$OutputDir = "$BaseDir\Deploy\Package\"
# Gets the number of commits since the last tag.
$Version = "0.2.1.0"
$BuildConfiguration = "Release"
$NuGetPackageName = "NLog.Targets.Gelf"
$NuGetPackDir = "$OutputDir" + "Pack"
$NuSpecFileName = "NLog.Targets.Gelf.nuspec"
$NuGetPackagePath = "$OutputDir" + $NuGetPackageName + "." + $Version + ".nupkg"
$ArchiveDir = "$OutputDir" + "Archive"
}
Framework '4.0'
task default -depends Pack
task Init {
}
task Clean -depends Init {
if (Test-Path $OutputDir) {
ri $OutputDir -Recurse
}
ri "$NuGetPackageName.*.nupkg"
ri "$NuGetPackageName.zip" -ea SilentlyContinue
}
task Build -depends Init,Clean {
exec { msbuild $SolutionFile "/p:OutDir=$OutputDir" "/p:Configuration=$BuildConfiguration" }
}
task Pack -depends Build {
mkdir $NuGetPackDir
cp "$NuSpecFileName" "$NuGetPackDir"
mkdir "$NuGetPackDir\lib\net40"
cp "$OutputDir\NLog.Targets.Gelf.dll" "$NuGetPackDir\lib\net40"
$Spec = [xml](get-content "$NuGetPackDir\$NuSpecFileName")
$Spec.package.metadata.version = ([string]$Spec.package.metadata.version).Replace("{Version}",$Version)
$Spec.Save("$NuGetPackDir\$NuSpecFileName")
exec { .\.nuget\nuget pack "$NuGetPackDir\$NuSpecFileName" -OutputDirectory "$OutputDir" }
}
task Publish -depends Pack {
exec { .\.nuget\nuget push $NuGetPackagePath }
}