forked from NEventStore/NEventStore.Persistence.SQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
51 lines (41 loc) · 2.47 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
$configurationdefault = "Release"
$artifacts = "../../artifacts"
$nugetartifacts = "artifacts"
$configuration = Read-Host 'Configuration to build [default: Release] ?'
if ($configuration -eq '') {
$configuration = $configurationdefault
}
$runtests = Read-Host 'Run Tests (y / n) [default:n] ?'
# Consider using NuGet to download the package (GitVersion.CommandLine)
choco install gitversion.portable --pre --y
choco upgrade gitversion.portable --pre --y
choco install nuget.commandline
choco upgrade nuget.commandline
# Display minimal restore information
dotnet restore ./src/NEventStore.Persistence.Sql.Core.sln --verbosity m
# GitVersion (for the main module)
Write-Host "Running GitVersion for the Project"
$str = gitversion /updateAssemblyInfo | out-string
$json = convertFrom-json $str
$nugetversion = $json.NuGetVersion
# Now we need to patch the AssemblyInfo for submodules
Write-Host "Running GitVersion for the Dependencies"
gitversion ".\dependencies\NEventStore" /updateAssemblyInfo | Out-Null
# Build
Write-Host "Building: "$nugetversion" "$configuration
dotnet build ./src/NEventStore.Persistence.Sql.Core.sln -c $configuration --no-restore
# Testing
if ($runtests -eq "y") {
Write-Host "Executing Tests"
dotnet test ./src/NEventStore.Persistence.Sql.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.Sql/NEventStore.Persistence.Sql.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.Sql/NEventStore.Persistence.Sql.Core.csproj --no-build -c $configuration -o $artifacts -p:NuspecProperties=""pippo=$configuration;version=$nugetversion"""
#dotnet pack ./src/NEventStore.Persistence.Sql/NEventStore.Persistence.Sql.Core.csproj --no-build -c $configuration -o $artifacts -p:NuspecFile="" -p:NuspecProperties="pippo=$configuration;version=$nugetversion"
#Write-Host nuget pack ./src/.nuget/NEventStore.Persistence.Sql.nuspec -properties "version=$nugetversion;configuration=$configuration"
nuget pack ./src/.nuget/NEventStore.Persistence.Sql.nuspec -properties "version=$nugetversion;configuration=$configuration" -OutputDirectory $nugetartifacts