-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-release.ps1
More file actions
115 lines (100 loc) · 4.58 KB
/
build-release.ps1
File metadata and controls
115 lines (100 loc) · 4.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# PiPStream Release Build Script
# This script builds the application and creates a Squirrel installer package
param(
[Parameter(Mandatory=$true)]
[string]$Version = "2.0.3"
)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "PiPStream Release Builder v$Version" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Clean previous builds
Write-Host "[1/6] Cleaning previous builds..." -ForegroundColor Yellow
Remove-Item -Path ".\bin\Release" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path ".\Releases" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "✓ Clean complete" -ForegroundColor Green
Write-Host ""
# Step 2: Restore NuGet packages
Write-Host "[2/6] Restoring NuGet packages..." -ForegroundColor Yellow
dotnet restore
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ NuGet restore failed" -ForegroundColor Red
exit 1
}
Write-Host "✓ Restore complete" -ForegroundColor Green
Write-Host ""
# Step 3: Build Release configuration
Write-Host "[3/6] Building Release configuration..." -ForegroundColor Yellow
dotnet build --configuration Release --no-restore
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Build failed" -ForegroundColor Red
exit 1
}
Write-Host "✓ Build complete" -ForegroundColor Green
Write-Host ""
# Step 4: Publish self-contained executable
Write-Host "[4/6] Publishing self-contained executable..." -ForegroundColor Yellow
dotnet publish --configuration Release --runtime win-x64 --self-contained true `
-p:PublishSingleFile=false `
-p:IncludeNativeLibrariesForSelfExtract=true `
--no-build
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Publish failed" -ForegroundColor Red
exit 1
}
Write-Host "✓ Publish complete" -ForegroundColor Green
Write-Host ""
# Step 5: Create NuGet package
Write-Host "[5/6] Creating NuGet package..." -ForegroundColor Yellow
$publishPath = ".\bin\Release\net8.0-windows\win-x64\publish"
# Update nuspec with current version
$nuspecContent = Get-Content "PiPStream.nuspec" -Raw
$nuspecContent = $nuspecContent -replace '<version>.*</version>', "<version>$Version</version>"
$nuspecContent | Set-Content "PiPStream.nuspec"
nuget pack PiPStream.nuspec -Version $Version -OutputDirectory ".\bin\Release"
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ NuGet pack failed" -ForegroundColor Red
Write-Host "Note: You may need to install NuGet CLI: https://www.nuget.org/downloads" -ForegroundColor Yellow
exit 1
}
Write-Host "✓ NuGet package created" -ForegroundColor Green
Write-Host ""
# Step 6: Create Squirrel installer
Write-Host "[6/6] Creating Squirrel installer..." -ForegroundColor Yellow
$releasesDir = ".\Releases"
New-Item -ItemType Directory -Path $releasesDir -Force | Out-Null
# Use Squirrel to create installer from NuGet package
$squirrelPath = (Get-ChildItem -Path "$env:USERPROFILE\.nuget\packages\squirrel.windows" -Recurse -Filter "Squirrel.exe" | Select-Object -First 1).FullName
if (-not $squirrelPath) {
Write-Host "✗ Squirrel.exe not found in NuGet packages" -ForegroundColor Red
Write-Host "Please ensure Squirrel.Windows is installed" -ForegroundColor Yellow
exit 1
}
& $squirrelPath --releasify ".\bin\Release\PiPStream.$Version.nupkg" --releaseDir="$releasesDir" --setupIcon=".\Assets\Icon\PiPStream_Icon.ico" --icon=".\Assets\Icon\PiPStream_Icon.ico"
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Squirrel installer creation failed" -ForegroundColor Red
exit 1
}
Write-Host "✓ Installer created" -ForegroundColor Green
Write-Host ""
# Success summary
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "✓ BUILD SUCCESSFUL" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Release files created in: $releasesDir" -ForegroundColor White
Write-Host ""
Write-Host "Files to upload to GitHub Releases:" -ForegroundColor Yellow
Get-ChildItem -Path $releasesDir | ForEach-Object {
Write-Host " - $($_.Name)" -ForegroundColor White
}
Write-Host ""
Write-Host "Setup installer: .\Releases\Setup.exe" -ForegroundColor Green
Write-Host "Users download Setup.exe to install PiPStream" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Create a new GitHub Release (tag: v$Version)" -ForegroundColor White
Write-Host "2. Upload ALL files from .\Releases\ to the release" -ForegroundColor White
Write-Host "3. Publish the release" -ForegroundColor White
Write-Host "4. Share Setup.exe download link with friends" -ForegroundColor White
Write-Host ""