-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
45 lines (36 loc) · 1.41 KB
/
build.ps1
File metadata and controls
45 lines (36 loc) · 1.41 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
# build.ps1
# Script to clean and build the solution
# remove previously installed tool
if (Get-Command "central-config" -ErrorAction SilentlyContinue) {
Write-Host "Uninstalling existing CentralConfigGenerator tool..." -ForegroundColor Cyan
dotnet tool uninstall --global CentralConfigGenerator
}
Write-Host "Cleaning solution..." -ForegroundColor Cyan
dotnet clean
Write-Host "Restoring packages..." -ForegroundColor Cyan
dotnet restore
Write-Host "Building solution..." -ForegroundColor Cyan
dotnet build --no-restore -c Release
if ($LASTEXITCODE -eq 0) {
Write-Host "Build completed successfully!" -ForegroundColor Green
}
else {
Write-Host "Build failed with exit code $LASTEXITCODE" -ForegroundColor Red
exit $LASTEXITCODE
}
Write-Host "Packing NuGet package..." -ForegroundColor Cyan
dotnet pack --no-build
if ($LASTEXITCODE -eq 0) {
Write-Host "Package created successfully!" -ForegroundColor Green
Write-Host "Publishing NuGet package..." -ForegroundColor Cyan
dotnet tool install --global --add-source .\CentralConfigGenerator\nupkg CentralConfigGenerator
if ($LASTEXITCODE -eq 0) {
Write-Host "Package published successfully!" -ForegroundColor Green
}
else {
Write-Host "Package publishing failed with exit code $LASTEXITCODE" -ForegroundColor Red
}
}
else {
Write-Host "Package creation failed with exit code $LASTEXITCODE" -ForegroundColor Red
}