fix: NSIS script — single-quoted here-string, no PS interpolation
Some checks failed
Build & Sign Wraith / Build Windows + Sign (push) Failing after 2m27s
Some checks failed
Build & Sign Wraith / Build Windows + Sign (push) Failing after 2m27s
PowerShell was eating $INSTDIR/$PROGRAMFILES64 and $version. Use single-quoted here-string with placeholder replacement. Pass full path to makensis instead of Push-Location. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5910e7a849
commit
372689fa03
@ -88,55 +88,56 @@ jobs:
|
||||
shell: powershell
|
||||
run: |
|
||||
$env:Path = "$env:EXTRA_PATH;$env:Path"
|
||||
$version = "${{ steps.version.outputs.version }}"
|
||||
$ver = "${{ steps.version.outputs.version }}"
|
||||
$outName = "Wraith_${ver}_x64-setup.exe"
|
||||
|
||||
# Stage files
|
||||
New-Item -ItemType Directory -Force -Path dist-pkg | Out-Null
|
||||
Copy-Item src-tauri\target\release\Wraith.exe dist-pkg\
|
||||
Copy-Item src-tauri\icons\icon.ico dist-pkg\wraith.ico -ErrorAction SilentlyContinue
|
||||
|
||||
# Write NSIS script
|
||||
@"
|
||||
# Write NSIS script — use single-quoted here-string to avoid PS interpolation
|
||||
$nsi = @'
|
||||
!include "MUI2.nsh"
|
||||
Name "Wraith"
|
||||
OutFile "Wraith_${version}_x64-setup.exe"
|
||||
InstallDir "`$PROGRAMFILES64\Wraith"
|
||||
OutFile "OUTFILE_PLACEHOLDER"
|
||||
InstallDir "$PROGRAMFILES64\Wraith"
|
||||
RequestExecutionLevel admin
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
Section "Install"
|
||||
SetOutPath "`$INSTDIR"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "Wraith.exe"
|
||||
File "wraith.ico"
|
||||
CreateDirectory "`$SMPROGRAMS\Wraith"
|
||||
CreateShortcut "`$SMPROGRAMS\Wraith\Wraith.lnk" "`$INSTDIR\Wraith.exe" "" "`$INSTDIR\wraith.ico"
|
||||
CreateShortcut "`$DESKTOP\Wraith.lnk" "`$INSTDIR\Wraith.exe" "" "`$INSTDIR\wraith.ico"
|
||||
WriteUninstaller "`$INSTDIR\uninstall.exe"
|
||||
CreateDirectory "$SMPROGRAMS\Wraith"
|
||||
CreateShortcut "$SMPROGRAMS\Wraith\Wraith.lnk" "$INSTDIR\Wraith.exe" "" "$INSTDIR\wraith.ico"
|
||||
CreateShortcut "$DESKTOP\Wraith.lnk" "$INSTDIR\Wraith.exe" "" "$INSTDIR\wraith.ico"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "DisplayName" "Wraith"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "UninstallString" "`$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "DisplayVersion" "${version}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "UninstallString" "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "DisplayVersion" "VER_PLACEHOLDER"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith" "Publisher" "Vigilance Cyber"
|
||||
SectionEnd
|
||||
Section "Uninstall"
|
||||
Delete "`$INSTDIR\Wraith.exe"
|
||||
Delete "`$INSTDIR\wraith.ico"
|
||||
Delete "`$INSTDIR\uninstall.exe"
|
||||
RMDir "`$INSTDIR"
|
||||
Delete "`$SMPROGRAMS\Wraith\Wraith.lnk"
|
||||
RMDir "`$SMPROGRAMS\Wraith"
|
||||
Delete "`$DESKTOP\Wraith.lnk"
|
||||
Delete "$INSTDIR\Wraith.exe"
|
||||
Delete "$INSTDIR\wraith.ico"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
Delete "$SMPROGRAMS\Wraith\Wraith.lnk"
|
||||
RMDir "$SMPROGRAMS\Wraith"
|
||||
Delete "$DESKTOP\Wraith.lnk"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wraith"
|
||||
SectionEnd
|
||||
"@ | Out-File -FilePath dist-pkg\installer.nsi -Encoding ascii
|
||||
'@
|
||||
$nsi = $nsi.Replace("OUTFILE_PLACEHOLDER", $outName).Replace("VER_PLACEHOLDER", $ver)
|
||||
$nsi | Out-File -FilePath dist-pkg\installer.nsi -Encoding ascii
|
||||
|
||||
# Build installer
|
||||
Push-Location dist-pkg
|
||||
makensis installer.nsi
|
||||
Pop-Location
|
||||
Move-Item "dist-pkg\Wraith_${version}_x64-setup.exe" .
|
||||
makensis dist-pkg\installer.nsi
|
||||
Move-Item "dist-pkg\$outName" .
|
||||
Write-Host "=== Installer built ==="
|
||||
Get-ChildItem "Wraith_${version}_x64-setup.exe"
|
||||
Get-ChildItem $outName
|
||||
|
||||
- name: Download jsign
|
||||
shell: powershell
|
||||
@ -162,9 +163,9 @@ jobs:
|
||||
shell: powershell
|
||||
run: |
|
||||
$env:Path = "$env:EXTRA_PATH;$env:Path"
|
||||
$version = "${{ steps.version.outputs.version }}"
|
||||
$ver = "${{ steps.version.outputs.version }}"
|
||||
Write-Host "=== Signing Wraith binaries ==="
|
||||
$binaries = @("src-tauri\target\release\Wraith.exe", "Wraith_${version}_x64-setup.exe")
|
||||
$binaries = @("src-tauri\target\release\Wraith.exe", "Wraith_${ver}_x64-setup.exe")
|
||||
foreach ($path in $binaries) {
|
||||
if (Test-Path $path) {
|
||||
Write-Host "Signing: $path"
|
||||
@ -185,6 +186,7 @@ jobs:
|
||||
run: |
|
||||
$version = "${{ steps.version.outputs.version }}"
|
||||
$installer = Get-Item "Wraith_${version}_x64-setup.exe"
|
||||
Write-Host "Installer: $($installer.FullName)"
|
||||
$hash = (Get-FileHash $installer.FullName -Algorithm SHA256).Hash.ToLower()
|
||||
$json = @{
|
||||
version = $version
|
||||
|
||||
Loading…
Reference in New Issue
Block a user