diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31648f0..20af945 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -228,7 +228,10 @@ jobs: mv "libusbK-tmp/${LIBUSBK_VERSION}" libusbK mv "${LIBUSBK_WDFCOINSTALLER}" "${LIBUSBK_WDFCOINSTALLER_RENAMED}" - - name: Set up MSYS2 + - name: Install dependencies (choco) + run: choco install nsis.portable + + - name: Install dependencies (msys2) uses: msys2/setup-msys2@v2 with: msystem: MINGW64 @@ -253,11 +256,20 @@ jobs: run: | make palera1n_mingw WITH_STATIC=1 WITH_GUI=1 BUILD_TYPE=Release JOBS=$(nproc) strip -s build/palera1n.exe + + - name: Package + run: | + mkdir -p dist\installer + copy build\*.exe dist\installer\ + copy build\*.dll dist\installer\ + copy packaging\installer.nsi dist\installer\ + copy resources\palera1n.ico dist\installer\icon.ico + makensis dist\installer\installer.nsi + move dist\installer\installer.exe dist\palera1n-windows-x86_64-setup.exe - name: Upload uses: actions/upload-artifact@v4 with: name: palera1n-windows-x86_64 path: | - build/*.exe - build/*.dll + dist/palera1n-windows-x86_64-setup.exe diff --git a/packaging/installer.nsi b/packaging/installer.nsi new file mode 100644 index 0000000..031bb00 --- /dev/null +++ b/packaging/installer.nsi @@ -0,0 +1,87 @@ +;=========================================================== +; Modern NSIS Installer for a Single EXE (64-bit) +;=========================================================== + +!define APPNAME "palera1n" +!define APPEXE "palera1n.exe" +!define COMPANY "palera1n" + +Name "${APPNAME}" +BrandingText "${APPNAME} Setup" + +OutFile "installer.exe" + +RequestExecutionLevel admin +InstallDir "$PROGRAMFILES64\${APPNAME}" +InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" + +;----------------------------------------------------------- +; Modern UI 2 +;----------------------------------------------------------- +!include "MUI2.nsh" + +!define MUI_ABORTWARNING +!define MUI_ICON "icon.ico" +!define MUI_UNICON "icon.ico" + +;----------------------------------------------------------- +; Installer Pages +;----------------------------------------------------------- +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +;----------------------------------------------------------- +; Uninstaller Pages +;----------------------------------------------------------- +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +;=========================================================== +; Installer Section +;=========================================================== +Section "Install" + + SetOutPath "$INSTDIR" + File "${APPEXE}" + File "*.dll" + + ; Start Menu entries + CreateDirectory "$SMPROGRAMS\${APPNAME}" + CreateShortcut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPEXE}" + + CreateShortcut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPEXE}" + + WriteUninstaller "$INSTDIR\Uninstall.exe" + + ; 64-bit registry uninstall entry + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANY}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\Uninstall.exe" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1 + +SectionEnd + +;=========================================================== +; Uninstaller Section +;=========================================================== +Section "Uninstall" + + Delete "$DESKTOP\${APPNAME}.lnk" + Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" + RMDir "$SMPROGRAMS\${APPNAME}" + + ; Delete all files + Delete "$INSTDIR\*.*" + RMDir /r "$INSTDIR" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" + +SectionEnd