-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.ps1
44 lines (34 loc) · 1.37 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
param(
[string]$configuration = 'Release',
[string]$path = $PSScriptRoot,
[string[]]$targets = 'default'
)
$ErrorActionPreference = "Stop"
# Boostrap posh-build
$build_dir = Join-Path $path ".build"
if (! (Test-Path (Join-Path $build_dir "Posh-Build.ps1"))) {
Write-Host "Installing posh-build..."; New-Item -Type Directory $build_dir -ErrorAction Ignore | Out-Null;
(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/jeremyskinner/posh-build/master/Posh-Build.ps1', "$build_dir/Posh-Build.ps1")
}
. (Join-Path $build_dir "Posh-Build.ps1")
# Set these variables as desired
$packages_dir = Join-Path $build_dir "packages"
$output_dir = Join-Path $build_dir $configuration
$solution_file = Join-Path $path "FluentValidation.AspNetCore.sln"
target default -depends compile, test, deploy
target compile {
Invoke-Dotnet build $solution_file -c $configuration --no-incremental
}
target test {
Invoke-Dotnet test $solution_file -c $configuration --no-build --logger trx
}
target deploy {
Remove-Item $packages_dir -Force -Recurse -ErrorAction Ignore 2> $null
Remove-Item $output_dir -Force -Recurse -ErrorAction Ignore 2> $null
Invoke-Dotnet pack $solution_file -c $configuration
}
target publish {
$key = $Env:NUGET_API_KEY
Nuget-Push -directory $packages_dir -key $key -prompt $true
}
Start-Build $targets