-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpack.ps1
More file actions
60 lines (52 loc) · 2.07 KB
/
pack.ps1
File metadata and controls
60 lines (52 loc) · 2.07 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
60
# Build and pack NuGet packages for DataFlow.NET
# Usage: .\pack.ps1 [-Configuration Release] [-Version 1.0.0]
param(
[string]$Configuration = "Release",
[string]$Version = "1.0.0",
[string]$OutputDir = ".\nupkgs"
)
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " DataFlow.NET NuGet Packer" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Configuration: $Configuration"
Write-Host "Version: $Version"
Write-Host "Output: $OutputDir"
Write-Host ""
# Clean output directory
if (Test-Path $OutputDir) {
Remove-Item $OutputDir -Recurse -Force
}
New-Item -ItemType Directory -Path $OutputDir | Out-Null
# Build the solution first
Write-Host "[1/3] Building solution..." -ForegroundColor Yellow
dotnet build DataFlow.Net.sln -c $Configuration /p:Version=$Version
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
# Pack DataFlow.Data
Write-Host "[2/3] Packing DataFlow.Data..." -ForegroundColor Yellow
dotnet pack DataFlow.Data.Read\DataFlow.Data.Read.csproj -c $Configuration /p:Version=$Version -o $OutputDir --no-build
if ($LASTEXITCODE -ne 0) {
Write-Host "Pack failed for DataFlow.Data!" -ForegroundColor Red
exit 1
}
# Pack DataFlow.Net (meta-package)
Write-Host "[3/3] Packing DataFlow.Net..." -ForegroundColor Yellow
dotnet pack DataFlow.Net\DataFlow.Net.csproj -c $Configuration /p:Version=$Version -o $OutputDir --no-build
if ($LASTEXITCODE -ne 0) {
Write-Host "Pack failed for DataFlow.Net!" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host " Packages created successfully!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Get-ChildItem $OutputDir -Filter *.nupkg | ForEach-Object {
Write-Host " - $($_.Name)" -ForegroundColor White
}
Write-Host ""
Write-Host "To publish: .\publish.ps1 -ApiKey YOUR_API_KEY" -ForegroundColor Cyan