@@ -18,10 +18,50 @@ inputs:
18
18
tenant_id :
19
19
description : " Azure signer app tenantId"
20
20
required : true
21
+ nsis_version :
22
+ description : " NSIS version to install if not already present"
23
+ default : ' 3.10'
24
+ required : true
21
25
22
26
runs :
23
27
using : composite
24
28
steps :
29
+ - name : Setup NSIS
30
+ # Install NSIS if not already installed on the runner
31
+ # See https://nsis.sourceforge.io/Download
32
+ shell : pwsh
33
+ env :
34
+ NSIS_VERSION : ${{ inputs.nsis_version }}
35
+ run : |
36
+ $ErrorActionPreference = 'Stop'
37
+ $version = $env:NSIS_VERSION
38
+ $existing = (Get-Command makensis.exe -ErrorAction SilentlyContinue)
39
+ if ($existing) {
40
+ Write-Host "Found existing makensis at $($existing.Source) - skipping download"
41
+ & $existing.Source -VERSION
42
+ return
43
+ }
44
+ $zipName = "nsis-$version.zip"
45
+ $url = "https://downloads.sourceforge.net/project/nsis/NSIS%203/$version/$zipName"
46
+ $zipPath = Join-Path $env:RUNNER_TEMP $zipName
47
+ Write-Host "Downloading NSIS $version from $url"
48
+ try {
49
+ $curlProcess = Start-Process -FilePath "curl.exe" -ArgumentList "-L", "-o", "`"$zipPath`"", "`"$url`"" -NoNewWindow -Wait -PassThru
50
+ if ($curlProcess.ExitCode -ne 0) { throw "curl exited with code $($curlProcess.ExitCode)" }
51
+ } catch {
52
+ Write-Error "Download failed with curl: $($_.Exception.Message)"
53
+ throw
54
+ }
55
+ $dest = Join-Path $env:RUNNER_TEMP "nsis-unpacked"
56
+ if (Test-Path $dest) { Remove-Item -Recurse -Force $dest }
57
+ Expand-Archive -Path $zipPath -DestinationPath $dest
58
+ $makensis = Get-ChildItem -Path $dest -Recurse -Filter makensis.exe | Select-Object -First 1
59
+ if (-not $makensis) { throw 'makensis.exe not found in extracted archive' }
60
+ $binDir = Split-Path $makensis.FullName
61
+ Add-Content -Path $env:GITHUB_PATH -Value $binDir
62
+ Write-Host "NSIS added to PATH: $binDir"
63
+ & $makensis.FullName -VERSION
64
+
25
65
- name : Fetch Windows app
26
66
uses : actions/download-artifact@v4
27
67
with :
@@ -56,23 +96,29 @@ runs:
56
96
id : nsis
57
97
shell : python
58
98
run : |
59
- # Logic derived from viewer_manifest.py - still needed though?
60
99
# Use Python because bash refuses to expand "${programfiles(x86)}" --
61
100
# even though that's really the name of the Windows environment
62
101
# variable.
63
102
import os
64
103
import shlex
65
104
from shutil import which
66
105
import subprocess
67
- nsis_path = which(
68
- "makensis",
69
- path=os.pathsep.join(
70
- os.path.join(program_files, subpath)
71
- for program_files in
72
- (os.getenv(var) for var in ('programfiles', 'programfiles(x86)'))
73
- for subpath in ('NSIS', r'NSIS\Unicode')
74
- if program_files))
75
- assert nsis_path
106
+
107
+ # First try to find makensis in PATH (for installed NSIS)
108
+ nsis_path = which("makensis")
109
+
110
+ # If not found in PATH, try the old Program Files locations (fallback)
111
+ if not nsis_path:
112
+ nsis_path = which(
113
+ "makensis",
114
+ path=os.pathsep.join(
115
+ os.path.join(program_files, subpath)
116
+ for program_files in
117
+ (os.getenv(var) for var in ('programfiles', 'programfiles(x86)'))
118
+ for subpath in ('NSIS', r'NSIS\Unicode')
119
+ if program_files))
120
+
121
+ assert nsis_path, "makensis not found in PATH or standard NSIS installation directories"
76
122
77
123
# This .nsi file was prepared by viewer_manifest.py (by substituting
78
124
# values into a template .nsi file) and bundled into the top level of
0 commit comments