Skip to content

Commit 6a218bc

Browse files
no
1 parent a6b77cb commit 6a218bc

1 file changed

Lines changed: 79 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,82 @@
1-
name: Build Binaries
1+
# Create NSIS installer script for Windows
2+
- name: Create NSIS installer script (Windows only)
3+
if: runner.os == 'Windows'
4+
run: |
5+
cat > installer.nsi << 'NSIS_EOF'
6+
Name "SilverFlagOVERSEE"
7+
InstallDir "$PROGRAMFILES64\SilverFlagOVERSEE"
8+
InstallDirRegKey HKLM "Software\SilverFlagOVERSEE" "Install_Dir"
9+
RequestExecutionLevel admin
10+
11+
!include "MUI2.nsh"
12+
13+
!if /FileExists "logo.ico"
14+
!define MUI_ICON "logo.ico"
15+
!define MUI_UNICON "logo.ico"
16+
!endif
17+
18+
!insertmacro MUI_PAGE_WELCOME
19+
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
20+
!insertmacro MUI_PAGE_DIRECTORY
21+
!insertmacro MUI_PAGE_INSTFILES
22+
!insertmacro MUI_PAGE_FINISH
23+
24+
!insertmacro MUI_UNPAGE_WELCOME
25+
!insertmacro MUI_UNPAGE_CONFIRM
26+
!insertmacro MUI_UNPAGE_INSTFILES
27+
!insertmacro MUI_UNPAGE_FINISH
28+
29+
!insertmacro MUI_LANGUAGE "English"
30+
31+
Section "Install"
32+
SetOutPath $INSTDIR
33+
34+
CreateDirectory "$SMPROGRAMS\SilverFlagOVERSEE"
35+
CreateShortcut "$SMPROGRAMS\SilverFlagOVERSEE\Uninstall.lnk" "$INSTDIR\uninstall.exe"
36+
CreateShortcut "$DESKTOP\SilverFlagOVERSEE.lnk" "$INSTDIR\SilverFlagOVERSEE.exe"
37+
38+
WriteRegStr HKLM "Software\SilverFlagOVERSEE" "Install_Dir" "$INSTDIR"
39+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "DisplayName" "SilverFlagOVERSEE"
40+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "UninstallString" "$INSTDIR\uninstall.exe"
41+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "DisplayVersion" "1.0.0"
42+
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "Publisher" "Your Company"
43+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "NoModify" 1
44+
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE" "NoRepair" 1
45+
46+
WriteUninstaller "$INSTDIR\uninstall.exe"
47+
SectionEnd
48+
49+
Section "Uninstall"
50+
Delete "$INSTDIR\SilverFlagOVERSEE.exe"
51+
Delete "$INSTDIR\SilverFlagOVERSEE-Win7.exe"
52+
Delete "$INSTDIR\uninstall.exe"
53+
RMDir "$INSTDIR"
54+
55+
Delete "$SMPROGRAMS\SilverFlagOVERSEE\SilverFlagOVERSEE.lnk"
56+
Delete "$SMPROGRAMS\SilverFlagOVERSEE\Uninstall.lnk"
57+
RMDir "$SMPROGRAMS\SilverFlagOVERSEE"
58+
Delete "$DESKTOP\SilverFlagOVERSEE.lnk"
59+
60+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SilverFlagOVERSEE"
61+
DeleteRegKey HKLM "Software\SilverFlagOVERSEE"
62+
SectionEnd
63+
NSIS_EOF
64+
65+
# Now modify the script based on build type
66+
if [[ "${{ matrix.build-type }}" == "win7-compatible" ]]; then
67+
sed -i '1i\OutFile "dist\\SilverFlagOVERSEE-Win7-Installer.exe"' installer.nsi
68+
sed -i '/SetOutPath \$INSTDIR/a\\ File "dist\\SilverFlagOVERSEE-Win7.exe"\n File "vcredist_x64.exe"\n ExecWait "$INSTDIR\\vcredist_x64.exe /quiet"\n Delete "$INSTDIR\\vcredist_x64.exe"' installer.nsi
69+
sed -i 's/CreateShortcut "$SMPROGRAMS\\SilverFlagOVERSEE\\SilverFlagOVERSEE.lnk"/CreateShortcut "$SMPROGRAMS\\SilverFlagOVERSEE\\SilverFlagOVERSEE.lnk" "$INSTDIR\\SilverFlagOVERSEE-Win7.exe"/' installer.nsi
70+
sed -i 's/CreateShortcut "$DESKTOP\\SilverFlagOVERSEE.lnk"/CreateShortcut "$DESKTOP\\SilverFlagOVERSEE.lnk" "$INSTDIR\\SilverFlagOVERSEE-Win7.exe"/' installer.nsi
71+
else
72+
sed -i '1i\OutFile "dist\\SilverFlagOVERSEE-Installer.exe"' installer.nsi
73+
sed -i '/SetOutPath \$INSTDIR/a\\ File "dist\\SilverFlagOVERSEE.exe"' installer.nsi
74+
sed -i 's/CreateShortcut "$SMPROGRAMS\\SilverFlagOVERSEE\\SilverFlagOVERSEE.lnk"/CreateShortcut "$SMPROGRAMS\\SilverFlagOVERSEE\\SilverFlagOVERSEE.lnk" "$INSTDIR\\SilverFlagOVERSEE.exe"/' installer.nsi
75+
sed -i 's/CreateShortcut "$DESKTOP\\SilverFlagOVERSEE.lnk"/CreateShortcut "$DESKTOP\\SilverFlagOVERSEE.lnk" "$INSTDIR\\SilverFlagOVERSEE.exe"/' installer.nsi
76+
fi
77+
78+
echo "NSIS installer script created successfully"
79+
shell: bashname: Build Binaries
280

381
on:
482
push:

0 commit comments

Comments
 (0)