Skip to content

Commit bbd1e32

Browse files
ci: add NSIS installer support for Windows releases
1 parent 8d5941c commit bbd1e32

3 files changed

Lines changed: 88 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ jobs:
1717
- name: Build
1818
run: cmake --build build --config Release
1919

20+
- name: Install NSIS
21+
run: choco install nsis -y
22+
23+
- name: Package Installer
24+
shell: bash
25+
run: ./tools/package-nsis.sh ${GITHUB_REF_NAME}
26+
2027
- name: Prepare Artifacts
2128
shell: bash
2229
run: |
2330
VERSION=${GITHUB_REF_NAME}
24-
mkdir -p dist
31+
# Move installer to dist if not already there, and keep other binaries
2532
cp build/Release/wininspectd.exe dist/wininspectd-${VERSION}-win-x64.exe
2633
cp build/Release/wininspect.exe dist/wininspect-${VERSION}-win-x64.exe
2734
cp build/Release/wininspect-gui.exe dist/wininspect-gui-${VERSION}-win-x64.exe

tools/package-nsis.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
3-
# Pull-first packaging runner placeholder.
4-
echo "[package-nsis.sh] TODO: integrate WBAB NSIS packaging runner (pull-first)."
5-
mkdir -p dist
6-
echo "placeholder installer artifact" > dist/WinInspect-Installer-PLACEHOLDER.txt
7-
exit 0
3+
4+
VERSION="${1:-dev}"
5+
WORKSPACE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
6+
DIST_DIR="${WORKSPACE_DIR}/dist"
7+
8+
mkdir -p "${DIST_DIR}"
9+
10+
echo "--- Packaging WinInspect Installer (Version: ${VERSION}) ---"
11+
12+
if command -v makensis &> /dev/null; then
13+
makensis -DVERSION="${VERSION}" "${WORKSPACE_DIR}/tools/wininspect.nsi"
14+
mv "${DIST_DIR}/WinInspect-Installer.exe" "${DIST_DIR}/WinInspect-Installer-${VERSION}.exe"
15+
else
16+
echo "ERROR: makensis not found. Cannot build installer."
17+
exit 1
18+
fi
19+
20+
echo "--- Packaging Complete ---"

tools/wininspect.nsi

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
!include "MUI2.nsh"
2+
3+
!ifndef VERSION
4+
!define VERSION "dev"
5+
!endif
6+
7+
Name "WinInspect ${VERSION}"
8+
OutFile "..\\dist\\WinInspect-Installer.exe"
9+
InstallDir "$PROGRAMFILES64\\WinInspect"
10+
RequestExecutionLevel admin
11+
12+
!define MUI_ABORTWARNING
13+
14+
!insertmacro MUI_PAGE_WELCOME
15+
!insertmacro MUI_PAGE_DIRECTORY
16+
!insertmacro MUI_PAGE_INSTFILES
17+
!insertmacro MUI_PAGE_FINISH
18+
19+
!insertmacro MUI_UNPAGE_WELCOME
20+
!insertmacro MUI_UNPAGE_CONFIRM
21+
!insertmacro MUI_UNPAGE_INSTFILES
22+
!insertmacro MUI_UNPAGE_FINISH
23+
24+
!insertmacro MUI_LANGUAGE "English"
25+
26+
Section "WinInspect Core" SecCore
27+
SetOutPath "$INSTDIR"
28+
29+
; Binaries (assuming they are in build/Release/)
30+
File "..\build\Release\wininspectd.exe"
31+
File "..\build\Release\wininspect.exe"
32+
File "..\build\Release\wininspect-gui.exe"
33+
34+
; License
35+
File "..\LICENSE"
36+
37+
; Registry keys for uninstaller
38+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinInspect" "DisplayName" "WinInspect"
39+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinInspect" "UninstallString" '"$INSTDIR\uninstall.exe"'
40+
WriteUninstaller "$INSTDIR\uninstall.exe"
41+
42+
; Shortcuts
43+
CreateDirectory "$SMPROGRAMS\WinInspect"
44+
CreateShortcut "$SMPROGRAMS\WinInspect\WinInspect GUI.lnk" "$INSTDIR\wininspect-gui.exe"
45+
CreateShortcut "$SMPROGRAMS\WinInspect\Uninstall WinInspect.lnk" "$INSTDIR\uninstall.exe"
46+
SectionEnd
47+
48+
Section "Uninstall"
49+
Delete "$INSTDIR\wininspectd.exe"
50+
Delete "$INSTDIR\wininspect.exe"
51+
Delete "$INSTDIR\wininspect-gui.exe"
52+
Delete "$INSTDIR\LICENSE"
53+
Delete "$INSTDIR\uninstall.exe"
54+
55+
RMDir "$INSTDIR"
56+
57+
Delete "$SMPROGRAMS\WinInspect\WinInspect GUI.lnk"
58+
Delete "$SMPROGRAMS\WinInspect\Uninstall WinInspect.lnk"
59+
RMDir "$SMPROGRAMS\WinInspect"
60+
61+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinInspect"
62+
SectionEnd

0 commit comments

Comments
 (0)