Files
aryx/assets/installer/windows.nsi
T
David KayaandCopilot f838d2ac15 feat: add native platform installers for Windows, macOS, and Linux
Replace zip/tar archive distribution with platform-native installers:

- Windows: NSIS installer (.exe) with per-user install to
  %LOCALAPPDATA%\Programs\Aryx, Start Menu and Desktop shortcuts,
  Add/Remove Programs registration, and silent install support
- macOS: DMG disk image (.dmg) with drag-to-Applications experience
  via create-dmg
- Linux: Debian package (.deb) with /opt/aryx installation,
  /usr/bin/aryx symlink, desktop entry, hicolor icons, and
  libsecret-1-0 dependency declaration

Add scripts/create-installer.ts as the platform-dispatching entry
point. Update CI workflow to produce native installers instead of
archives. Add installerAssetName to ReleaseTarget interface.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-26 13:06:50 +01:00

113 lines
3.9 KiB
NSIS

!include "MUI2.nsh"
;--- Product metadata (passed via /D defines from the build script) ---
!ifndef PRODUCT_NAME
!define PRODUCT_NAME "Aryx"
!endif
!ifndef PRODUCT_VERSION
!define PRODUCT_VERSION "0.0.0"
!endif
!ifndef PRODUCT_PUBLISHER
!define PRODUCT_PUBLISHER "David Kaya"
!endif
!ifndef SOURCE_DIR
!error "SOURCE_DIR must be defined (path to the packaged app directory)."
!endif
!ifndef OUTPUT_PATH
!error "OUTPUT_PATH must be defined (path to the output installer .exe)."
!endif
;--- Installer attributes ---
Name "${PRODUCT_NAME}"
OutFile "${OUTPUT_PATH}"
InstallDir "$LOCALAPPDATA\Programs\${PRODUCT_NAME}"
InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" "InstallDir"
RequestExecutionLevel user
SetCompressor /SOLID lzma
;--- Version info embedded in the installer EXE ---
VIProductVersion "${PRODUCT_VERSION}.0"
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Setup"
VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
VIAddVersionKey "LegalCopyright" "Copyright ${PRODUCT_PUBLISHER}"
;--- MUI configuration ---
!define MUI_ABORTWARNING
;--- Installer pages ---
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_NAME}.exe"
!insertmacro MUI_PAGE_FINISH
;--- Uninstaller pages ---
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--- Language ---
!insertmacro MUI_LANGUAGE "English"
;--- Installer section ---
Section "Install"
; Close any running instance
ExecWait 'taskkill /F /IM ${PRODUCT_NAME}.exe' $0
SetOutPath "$INSTDIR"
File /r "${SOURCE_DIR}\*.*"
; Write uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
; Start Menu shortcut
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
CreateShortcut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall.exe"
; Desktop shortcut
CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
; Add/Remove Programs registry entry
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S'
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayIcon" "$INSTDIR\${PRODUCT_NAME}.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"Publisher" "${PRODUCT_PUBLISHER}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"DisplayVersion" "${PRODUCT_VERSION}"
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"NoModify" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"NoRepair" 1
; Store install directory for future upgrades
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "InstallDir" "$INSTDIR"
SectionEnd
;--- Uninstaller section ---
Section "Uninstall"
; Close any running instance
ExecWait 'taskkill /F /IM ${PRODUCT_NAME}.exe' $0
; Remove application files
RMDir /r "$INSTDIR"
; Remove shortcuts
RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}"
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
; Remove registry entries
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
SectionEnd