-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
34 lines (28 loc) · 932 Bytes
/
build.ps1
File metadata and controls
34 lines (28 loc) · 932 Bytes
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
param(
[Parameter(Position = 0, ValueFromPipeline)]
[string] $Version = "1.0.0",
[Parameter(Position = 1, ValueFromPipeline)]
[ValidateSet("Debug", "Release")]
[string] $Configuration = "Release",
[Parameter(Position = 2, ValueFromPipeline)]
[switch] $RunTests,
[Parameter(Position = 3, ValueFromPipeline)]
[switch] $Nupkg
)
Write-Host "Building MongoMigrations.Core v$Version" -ForegroundColor Green
# Build
dotnet build --configuration $Configuration /p:Version=$Version /p:GeneratePackageOnBuild=$Nupkg
if ($LASTEXITCODE -ne 0) {
Write-Error "Build failed"
exit $LASTEXITCODE
}
# Test (if requested)
if ($RunTests) {
Write-Host "Running tests..." -ForegroundColor Green
dotnet test --configuration $Configuration --no-build
if ($LASTEXITCODE -ne 0) {
Write-Error "Tests failed"
exit $LASTEXITCODE
}
}
Write-Host "Done!" -ForegroundColor Green