Skip to content

Commit b9432ec

Browse files
committed
Add windows installer
1 parent d01ffbe commit b9432ec

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ jobs:
153153
ninja -j2
154154
cd ..
155155
./script/deploy_windows64.sh
156+
- name: Build Installer with NSIS
157+
shell: cmd
158+
if: matrix.platform == 'windows-latest'
159+
run: |
160+
cp .\script\windows_installer.nsi .
161+
makensis windows_installer.nsi
162+
cp NekoraySetup.exe deployment/
156163
- name: Linux - Generate MakeFile and Build
157164
shell: bash
158165
if: matrix.platform == 'ubuntu-22.04'
@@ -216,6 +223,7 @@ jobs:
216223
zip -9 -r $version_standalone-linux64.zip nekoray
217224
rm -rf nekoray
218225
####
226+
mv NekoraySetup.exe $version_standalone-windows64-installer.exe
219227
mv windows64 nekoray
220228
zip -9 -r $version_standalone-windows64.zip nekoray
221229
rm -rf nekoray

res/nekorayDel.ico

66.1 KB
Binary file not shown.

script/windows_installer.nsi

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Name "Nekoray"
2+
OutFile "NekoraySetup.exe"
3+
InstallDir "$PROGRAMFILES\Nekoray"
4+
RequestExecutionLevel admin
5+
6+
!include MUI2.nsh
7+
!define MUI_ICON "res\nekoray.ico"
8+
!define MUI_ABORTWARNING
9+
!define MUI_WELCOMEPAGE_TITLE "Welcome to Nekoray Installer"
10+
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Nekoray."
11+
!define MUI_FINISHPAGE_RUN "$INSTDIR\nekoray.exe"
12+
!define MUI_FINISHPAGE_RUN_TEXT "Launch Nekoray"
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_LANGUAGE "English"
20+
21+
UninstallText "This will uninstall Nekoray. Do you wish to continue?"
22+
UninstallIcon "res\nekorayDel.ico"
23+
24+
Section "Install"
25+
SetOutPath "$INSTDIR"
26+
27+
File /r ".\deployment\windows64\*"
28+
29+
CreateShortcut "$desktop\Nekoray.lnk" "$instdir\nekoray.exe"
30+
31+
CreateDirectory "$SMPROGRAMS\Nekoray"
32+
CreateShortcut "$SMPROGRAMS\Nekoray\Nekoray.lnk" "$INSTDIR\nekoray.exe" "" "$INSTDIR\nekoray.exe" 0
33+
CreateShortcut "$SMPROGRAMS\Nekoray\Uninstall Nekoray.lnk" "$INSTDIR\uninstall.exe"
34+
35+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray" "DisplayName" "Nekoray"
36+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray" "UninstallString" "$INSTDIR\uninstall.exe"
37+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray" "InstallLocation" "$INSTDIR"
38+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray" "NoModify" 1
39+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray" "NoRepair" 1
40+
WriteUninstaller "uninstall.exe"
41+
SectionEnd
42+
43+
Section "Uninstall"
44+
45+
!define stopCommand 'powershell -ExecutionPolicy Bypass -NoExit -command "&{Stop-Process -Id (Get-CimInstance -ClassName Win32_Process -Filter $\'Name = $\'$\'nekoray.exe$\'$\'$\' | Where-Object { `$_`.ExecutablePath -eq $\'$INSTDIR\nekoray.exe$\' }).ProcessId -Force}"'
46+
ExecWait '${stopCommand}'
47+
48+
Delete "$SMPROGRAMS\Nekoray\Nekoray.lnk"
49+
Delete "$SMPROGRAMS\Nekoray\Uninstall Nekoray.lnk"
50+
Delete "$desktop\Nekoray.lnk"
51+
RMDir "$SMPROGRAMS\Nekoray"
52+
53+
RMDir /r "$INSTDIR"
54+
55+
Delete "$INSTDIR\uninstall.exe"
56+
57+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nekoray"
58+
SectionEnd

0 commit comments

Comments
 (0)