-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.ps1
More file actions
56 lines (51 loc) · 1.81 KB
/
Copy pathpublish.ps1
File metadata and controls
56 lines (51 loc) · 1.81 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
# publish.ps1
# Interactive publication utility script for Coalesce
# 1. Automatically detect the host OS to set target runtime identifier (RID)
$Runtime = "win-x64"
if ($IsMacOS) {
$Runtime = "osx-arm64"
}
elseif ($IsLinux) {
$Runtime = "linux-x64"
}
# 2. Render clean, minimal menu
Write-Host "`n--- COALESCE PUBLISH UTILITY ---" -ForegroundColor Cyan
Write-Host "1) Portable (Framework-Dependent)"
Write-Host "2) Standalone (Self-Contained & Trimmed)"
Write-Host "3) Native AOT (Ahead-of-Time)"
Write-Host "4) All Configurations"
Write-Host ""
$Choice = Read-Host "Select option (1-4)"
# 3. Execute publish based on choice
switch ($Choice) {
"1" {
& dotnet publish -c Release -o ./artifacts/publish/portable
}
"2" {
& dotnet publish -c Release -r $Runtime --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./artifacts/publish/self-contained
}
"3" {
& dotnet publish -c Release -r $Runtime -p:PublishAot=true -o ./artifacts/publish/aot
}
"4" {
Write-Host "`nPublishing all configurations..." -ForegroundColor Cyan
& dotnet publish -c Release -o ./artifacts/publish/portable
if ($LASTEXITCODE -eq 0) {
& dotnet publish -c Release -r $Runtime --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./artifacts/publish/self-contained
}
if ($LASTEXITCODE -eq 0) {
& dotnet publish -c Release -r $Runtime -p:PublishAot=true -o ./artifacts/publish/aot
}
}
Default {
Write-Host "Invalid choice. Canceled." -ForegroundColor Red
Exit 1
}
}
# 4. Display result summary
if ($LASTEXITCODE -eq 0) {
Write-Host "`nPublish completed successfully!" -ForegroundColor Green
} else {
Write-Host "`nPublish failed!" -ForegroundColor Red
Exit 1
}