From 372689fa03a4409ad7bfbe4c41a35995de9a2e49 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Wed, 18 Mar 2026 00:50:52 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20NSIS=20script=20=E2=80=94=20single-quote?= =?UTF-8?q?d=20here-string,=20no=20PS=20interpolation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .gitea/workflows/build-release.yml | 56 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/build-release.yml b/.gitea/workflows/build-release.yml index 800cfd8..476d8af 100644 --- a/.gitea/workflows/build-release.yml +++ b/.gitea/workflows/build-release.yml @@ -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