-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
49 lines (41 loc) · 1.96 KB
/
build.ps1
File metadata and controls
49 lines (41 loc) · 1.96 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
# ============================================================================
# WINUX Build & Sign Script
# ============================================================================
# Usage: .\build.ps1 [-Version "0.3.11"]
param(
[string]$Version = "0.3.11"
)
# Configuration
$GoPath = "go"
$InnoPath = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
$ArtifactsDir = "installer"
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " WINUX Build Script v$Version" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
# Step 1: Build winux.exe
Write-Host "[1/3] Building winux.exe..." -ForegroundColor Cyan
$LdFlags = "-s -w -X main.Version=$Version -X github.com/CRTYPUBG/winux/internal/core.Version=$Version"
& $GoPath build -trimpath -ldflags $LdFlags -o winux.exe ./cmd/winux
if ($LASTEXITCODE -ne 0) { throw "Winux build failed" }
# Step 2: Build update.exe
Write-Host "[2/3] Building update.exe..." -ForegroundColor Cyan
$UpdateLdFlags = "-s -w -X main.CurrentVersion=$Version -X github.com/CRTYPUBG/winux/internal/updater.CurrentVersion=$Version"
& $GoPath build -trimpath -ldflags $UpdateLdFlags -o update.exe ./cmd/update
if ($LASTEXITCODE -ne 0) { throw "Update build failed" }
# Step 3: Compile installer
Write-Host "[3/3] Compiling installer..." -ForegroundColor Cyan
& $InnoPath "/DMyAppVersion=$Version" winux.iss
if ($LASTEXITCODE -ne 0) { throw "Installer compilation failed" }
# Generate SHA256
Write-Host ""
Write-Host "Generating checksums..." -ForegroundColor Cyan
$Files = @("winux.exe", "update.exe", "$ArtifactsDir\winux-$Version-setup.exe")
foreach ($f in $Files) {
if (Test-Path $f) {
$hash = (Get-FileHash $f -Algorithm SHA256).Hash.ToLower()
Write-Host " $f : $hash"
"$hash $(Split-Path $f -Leaf)" | Out-File -Append -FilePath "$ArtifactsDir\checksums.sha256" -Encoding ascii
}
}
Write-Host ""
Write-Host "BUILD COMPLETE!" -ForegroundColor Green