mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 21:04:59 +00:00
feat: add windows x64 installer build with NSIS (#175)
This commit is contained in:
parent
d3042bbe8d
commit
4eb068e949
4 changed files with 100 additions and 0 deletions
|
@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{773082AC
|
|||
build\build.linux.sh = build\build.linux.sh
|
||||
build\build.osx.command = build\build.osx.command
|
||||
build\build.windows.ps1 = build\build.windows.ps1
|
||||
build\build.windows.installer.nsi = build\build.windows.installer.nsi
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "resources", "resources", "{FD384607-ED99-47B7-AF31-FB245841BC92}"
|
||||
|
@ -38,6 +39,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{ABC98884-F02
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
build\resources\app\App.icns = build\resources\app\App.icns
|
||||
build\resources\app\App.plist = build\resources\app\App.plist
|
||||
build\resources\app\App.ico = build\resources\app\App.ico
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_common", "_common", "{04FD74B1-FBDB-496E-A48F-3D59D71FF952}"
|
||||
|
|
89
build/build.windows.installer.nsi
Normal file
89
build/build.windows.installer.nsi
Normal file
|
@ -0,0 +1,89 @@
|
|||
; Application properties
|
||||
!define PRODUCT_NAME "SourceGit"
|
||||
!define PRODUCT_VERSION ${VERSION}
|
||||
!define PRODUCT_PUBLISHER "sourcegit-scm"
|
||||
!define PRODUCT_WEB_SITE "https://github.com/sourcegit-scm/sourcegit"
|
||||
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\${PRODUCT_NAME}\SourceGit.exe"
|
||||
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
||||
|
||||
; Set installation and uninstallation icons and name
|
||||
!define MUI_ICON "resources\app\App.ico"
|
||||
!define MUI_UNICON "resources\app\App.ico"
|
||||
|
||||
; Language Selection Dialog Settings
|
||||
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
|
||||
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
||||
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
||||
|
||||
; Include language files
|
||||
!include "MUI2.nsh"
|
||||
|
||||
; Set pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Set language
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
|
||||
; Component descriptions
|
||||
LangString DESC_SecDesktopShortcut ${LANG_ENGLISH} "Create a desktop shortcut."
|
||||
LangString DESC_SecStartMenuShortcut ${LANG_ENGLISH} "Create a start menu shortcut."
|
||||
|
||||
; Define some basic properties
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
Outfile "sourcegit_${VERSION}.win-x64.installer.exe"
|
||||
InstallDir $PROGRAMFILES64\${PRODUCT_NAME}
|
||||
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
||||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
RequestExecutionLevel admin
|
||||
|
||||
Function .onInit
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
FunctionEnd
|
||||
|
||||
; Start installation section
|
||||
Section "Install"
|
||||
|
||||
; Set version
|
||||
WriteRegStr HKLM "Software\${PRODUCT_NAME}" "Version" ${VERSION}
|
||||
|
||||
; Copy files to installation directory
|
||||
SetOutPath $INSTDIR
|
||||
File /r "SourceGit\*.*"
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\SourceGit"
|
||||
CreateShortCut "$SMPROGRAMS\SourceGit\SourceGit.lnk" "$INSTDIR\SourceGit.exe"
|
||||
CreateShortCut "$DESKTOP\SourceGit.lnk" "$INSTDIR\SourceGit.exe"
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninst.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\SourceGit.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" '$\"$INSTDIR\uninst.exe$\"'
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" '$\"$INSTDIR\uninst.exe$\"'
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
SectionEnd
|
||||
|
||||
; Start uninstallation section
|
||||
Section "Uninstall"
|
||||
|
||||
; Delete all files and directories
|
||||
RMDir /r $INSTDIR
|
||||
|
||||
Delete "$DESKTOP\SourceGit.lnk"
|
||||
Delete "$SMPROGRAMS\SourceGit\SourceGit.lnk"
|
||||
RMDir "$SMPROGRAMS\SourceGit"
|
||||
|
||||
; Delete uninstallation information
|
||||
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
||||
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
|
||||
|
||||
SectionEnd
|
|
@ -21,3 +21,12 @@ dotnet publish ..\src\SourceGit.csproj -c Release -r win-x64 -o SourceGit -p:Pub
|
|||
Remove-Item SourceGit\*.pdb -Force
|
||||
|
||||
Compress-Archive -Path SourceGit -DestinationPath "sourcegit_$version.win-x64.zip"
|
||||
|
||||
# check nsis exist
|
||||
$nsisPath = Join-Path -Path ${env:ProgramFiles(x86)} -ChildPath "NSIS\makensis.exe"
|
||||
if (-not (Test-Path $nsisPath)) {
|
||||
Write-Host "NSIS not found, please install NSIS from https://nsis.sourceforge.io/Download or run 'choco install nsis -y'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
& $nsisPath /DVERSION=$version .\build.windows.installer.nsi
|
||||
|
|
BIN
build/resources/app/App.ico
Normal file
BIN
build/resources/app/App.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Add table
Add a link
Reference in a new issue