-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild-windows.ps1
More file actions
71 lines (56 loc) · 2.25 KB
/
build-windows.ps1
File metadata and controls
71 lines (56 loc) · 2.25 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
# Noah Windows Build Script
# Usage (from project root):
# powershell -File build-windows.ps1 # Full release build
# powershell -File build-windows.ps1 -Check # Compile check only
# powershell -File build-windows.ps1 -Upload # Build + upload
# powershell -File build-windows.ps1 -Tag v0.15.0 # Specific tag
# powershell -File build-windows.ps1 -SkipInstall # Skip pnpm install
param(
[switch]$Check,
[switch]$Upload,
[string]$Tag,
[switch]$SkipInstall
)
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
# ── Ensure tools are on PATH ──
$cargobin = Join-Path $env:USERPROFILE ".cargo\bin"
if (Test-Path $cargobin) { $env:PATH = "$cargobin;$env:PATH" }
$nvmDir = Join-Path $env:APPDATA "nvm"
if (Test-Path $nvmDir) {
$nodeVer = Get-ChildItem $nvmDir -Directory |
Where-Object { $_.Name -match '^v\d' } |
Sort-Object Name -Descending |
Select-Object -First 1
if ($nodeVer) { $env:PATH = "$($nodeVer.FullName);$env:PATH" }
}
$pnpmHome = Join-Path $env:LOCALAPPDATA "pnpm"
if (Test-Path $pnpmHome) { $env:PATH = "$pnpmHome;$env:PATH" }
# ── Signing key ──
$keyFile = Join-Path $env:USERPROFILE ".tauri\noah.key"
if (Test-Path $keyFile) {
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content $keyFile -Raw
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "searchformeaning"
} else {
Write-Host "WARNING: Signing key not found at $keyFile" -ForegroundColor Yellow
}
# ── Check-only mode ──
if ($Check) {
Write-Host "==> Compile-checking noah-desktop..."
cargo check -p noah-desktop
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Write-Host "==> Compile check passed." -ForegroundColor Green
exit 0
}
# ── Build / Release ──
Write-Host "==> Pulling latest..."
git pull
$argsList = @()
if ($Upload) { $argsList += '--upload' } else { $argsList += '--build' }
if ($Tag) { $argsList += @('--tag', $Tag) }
if ($SkipInstall) { $argsList += '--skip-install' }
node .\scripts\release.mjs @argsList
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$conf = Get-Content apps\desktop\src-tauri\tauri.conf.json | ConvertFrom-Json
$v = $conf.version
Write-Host "`n==> Done! Artifacts in target\release\bundle\" -ForegroundColor Green