-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.ps1
47 lines (37 loc) · 2.42 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
$configurationdefault = "Release"
$artifacts = "../../artifacts"
$configuration = Read-Host 'Configuration to build [default: Release] ?'
if ($configuration -eq '') {
$configuration = $configurationdefault
}
$runtests = Read-Host 'Run Tests (y / n) [default:n] ?'
# Install gitversion tool
dotnet tool restore
# Display minimal restore information
dotnet restore ./src/NEventStore.Persistence.MongoDB.Core.sln --verbosity m
# GitVersion (for the main module)
Write-Host "Running GitVersion for the Project"
$str = dotnet tool run dotnet-gitversion /updateAssemblyInfo | out-string
$json = convertFrom-json $str
$nugetversion = $json.SemVer
# Now we need to patch the AssemblyInfo for submodules
Write-Host "Running GitVersion for the Dependencies"
dotnet tool run dotnet-gitversion ".\dependencies\NEventStore" /updateAssemblyInfo | Out-Null
# Build
Write-Host "Building: "$nugetversion" "$configuration
dotnet build ./src/NEventStore.Persistence.MongoDB.Core.sln -c $configuration --no-restore
# Testing
if ($runtests -eq "y") {
Write-Host "Executing Tests"
dotnet test ./src/NEventStore.Persistence.MongoDB.Core.sln -c $configuration --no-build
Write-Host "Tests Execution Complated"
}
# NuGet packages
Write-Host "NuGet Packages creation"
# not working well, without a nuspec file ProjectReferences get the wrong version number
#dotnet pack ./src/NEventStore.Persistence.MongoDB/NEventStore.Persistence.MongoDB.Core.csproj -c $configuration --no-build -o $artifacts -p:PackageVersion=$nugetversion
# not working well, with a reference to a nuspec file, it seems i'm not able to pass in the $configuration to retrieve the correct files
#Write-Host "dotnet pack ./src/NEventStore.Persistence.MongoDB/NEventStore.Persistence.MongoDB.Core.csproj --no-build -c $configuration -o $artifacts -p:NuspecProperties=""pippo=$configuration;version=$nugetversion"""
#dotnet pack ./src/NEventStore.Persistence.MongoDB/NEventStore.Persistence.MongoDB.Core.csproj --no-build -c $configuration -o $artifacts -p:NuspecFile="" -p:NuspecProperties="pippo=$configuration;version=$nugetversion"
#Write-Host nuget pack ./src/.nuget/NEventStore.Persistence.MongoDB.nuspec -properties "version=$nugetversion;configuration=$configuration"
nuget pack ./src/.nuget/NEventStore.Persistence.MongoDB.nuspec -properties "version=$nugetversion;configuration=$configuration" -OutputDirectory $artifacts -Symbols -SymbolPackageFormat snupkg