-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.ps1
More file actions
59 lines (47 loc) · 1.58 KB
/
build.ps1
File metadata and controls
59 lines (47 loc) · 1.58 KB
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
55
56
57
58
59
# Build script for Zetian SMTP Server Library
param(
[string]$Configuration = "Release",
[switch]$Pack,
[switch]$Test,
[switch]$Clean
)
$ErrorActionPreference = "Stop"
Write-Host "Zetian SMTP Server Library - Build Script" -ForegroundColor Cyan
Write-Host "===========================================" -ForegroundColor Cyan
Write-Host ""
# Clean
if ($Clean) {
Write-Host "Cleaning solution..." -ForegroundColor Yellow
dotnet clean --configuration $Configuration
if (Test-Path "artifacts") {
Remove-Item -Path "artifacts" -Recurse -Force
}
}
# Restore
Write-Host "Restoring packages..." -ForegroundColor Yellow
dotnet restore
# Build
Write-Host "Building solution in $Configuration mode..." -ForegroundColor Yellow
dotnet build --configuration $Configuration --no-restore
# Test
if ($Test) {
Write-Host "Running tests..." -ForegroundColor Yellow
dotnet test --configuration $Configuration --no-build --verbosity normal
}
# Pack
if ($Pack) {
Write-Host "Creating NuGet package..." -ForegroundColor Yellow
if (-not (Test-Path "artifacts")) {
New-Item -ItemType Directory -Path "artifacts" | Out-Null
}
dotnet pack src/Zetian/Zetian.csproj `
--configuration $Configuration `
--no-build `
--output artifacts
Write-Host "Package created in artifacts folder" -ForegroundColor Green
Get-ChildItem -Path "artifacts" -Filter "*.nupkg" | ForEach-Object {
Write-Host " - $($_.Name)" -ForegroundColor Gray
}
}
Write-Host ""
Write-Host "Build completed successfully!" -ForegroundColor Green