Skip to content

Commit bd19ad1

Browse files
committed
ci: NSIS 安装改为重试加直接下载兜底
Chocolatey 社区源偶发 5xx(choco 遇 503/504 会装 0 个包但仍退出 0), v2.6.42 的 Windows 安装器因此没打出来。安装步骤改为以 makensis 是否真的 存在为准,层层兜底:已预装则直接用 → 重试 choco 三次 → 仍不可用则下载 官方便携版;发现的目录统一写入 GITHUB_PATH,兼容各种落点。发布 v2.6.43。
1 parent 0cd9009 commit bd19ad1

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,46 @@ jobs:
154154
run: cd frontend && npx vue-tsc --noEmit
155155

156156
- name: Install NSIS
157-
run: choco install nsis -y
157+
shell: pwsh
158+
run: |
159+
# Chocolatey 社区源偶发 5xx(choco 遇 503/504 会"装 0 个包"但仍退出 0),
160+
# 因此一律以"makensis 是否真的存在"为准,并层层兜底:
161+
# 已预装 → 重试 choco → 直接下载官方便携版
162+
function Find-NsisDir {
163+
foreach ($p in @("C:\Program Files (x86)\NSIS\makensis.exe", "C:\Program Files\NSIS\makensis.exe")) {
164+
if (Test-Path $p) { return (Split-Path $p) }
165+
}
166+
$cmd = Get-Command makensis -ErrorAction SilentlyContinue
167+
if ($cmd) { return (Split-Path $cmd.Source) }
168+
return $null
169+
}
170+
# 把发现的目录导出到后续步骤的 PATH,兼容 choco/预装/便携版各种落点
171+
function Publish-Nsis($dir) {
172+
Add-Content -Path $env:GITHUB_PATH -Value $dir
173+
Write-Host "NSIS 目录已加入 PATH: $dir"
174+
}
175+
176+
$dir = Find-NsisDir
177+
if ($dir) { Publish-Nsis $dir; exit 0 }
178+
179+
for ($i = 1; $i -le 3; $i++) {
180+
Write-Host "choco install nsis 第 $i 次尝试"
181+
choco install nsis -y --no-progress
182+
$dir = Find-NsisDir
183+
if ($dir) { Publish-Nsis $dir; exit 0 }
184+
Write-Host "第 $i 次未成功(源可能暂不可用),20s 后重试"
185+
Start-Sleep -Seconds 20
186+
}
187+
188+
Write-Host "choco 持续不可用,回退到官方便携版直接下载"
189+
$ver = "3.10"
190+
$zip = Join-Path $env:RUNNER_TEMP "nsis.zip"
191+
$dest = "C:\nsis-portable"
192+
Invoke-WebRequest -Uri "https://prdownloads.sourceforge.net/nsis/nsis-$ver.zip?download" -OutFile $zip -UseBasicParsing
193+
Expand-Archive -Path $zip -DestinationPath $dest -Force
194+
$makensis = Get-ChildItem -Path $dest -Recurse -Filter makensis.exe | Select-Object -First 1
195+
if (-not $makensis) { throw "NSIS 便携版下载/解压失败,未找到 makensis.exe" }
196+
Publish-Nsis (Split-Path $makensis.FullName)
158197

159198
- name: Update build assets
160199
run: wails3 task common:update:build-assets

‎version_service.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package main
22

3-
const AppVersion = "v2.6.42"
3+
const AppVersion = "v2.6.43"
44

55
// UpdatePolicy 更新策略(可通过 -ldflags "-X main.UpdatePolicy=installer" 覆盖)
66
// 可选值:auto(默认)、portable、installer

0 commit comments

Comments
 (0)