chore(workflows): produce NSIS windows installers (#142)
* chore(workflows): produce NSIS windows installers Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,167 @@
|
||||
!define APP_NAME "Kapow!"
|
||||
!define COMP_NAME "BBVA Innovation Labs"
|
||||
!define WEB_SITE "https://kapow.readthedocs.io/en/v$%NSIS_VERSION%/"
|
||||
!define VERSION "$%NSIS_VERSION%.0"
|
||||
!define COPYRIGHT "BBVA, 2019-2020"
|
||||
!define DESCRIPTION "Kapow! If you can script it, you can HTTP it."
|
||||
!define INSTALLER_NAME "$%NSIS_INSTALLER_NAME%"
|
||||
!define MAIN_APP_EXE "kapow.exe"
|
||||
!define ICON "kapow.ico"
|
||||
!define BANNER "kapow.bmp"
|
||||
!define LICENSE_TXT "../../LICENSE"
|
||||
|
||||
!define INSTALL_DIR "$PROGRAMFILES64\${APP_NAME}"
|
||||
!define INSTALL_TYPE "SetShellVarContext all"
|
||||
!define REG_ROOT "HKLM"
|
||||
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${MAIN_APP_EXE}"
|
||||
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
||||
!define REG_START_MENU "Start Menu Folder"
|
||||
|
||||
var SM_Folder
|
||||
|
||||
######################################################################
|
||||
|
||||
VIProductVersion "${VERSION}"
|
||||
VIAddVersionKey "ProductName" "${APP_NAME}"
|
||||
VIAddVersionKey "CompanyName" "${COMP_NAME}"
|
||||
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
|
||||
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
|
||||
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||
|
||||
######################################################################
|
||||
|
||||
SetCompressor /SOLID Lzma
|
||||
Name "${APP_NAME}"
|
||||
Caption "${APP_NAME}"
|
||||
OutFile "${INSTALLER_NAME}"
|
||||
BrandingText "${APP_NAME}"
|
||||
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
|
||||
InstallDir "${INSTALL_DIR}"
|
||||
|
||||
######################################################################
|
||||
|
||||
!define MUI_ICON "${ICON}"
|
||||
!define MUI_UNICON "${ICON}"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "${BANNER}"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${BANNER}"
|
||||
|
||||
######################################################################
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_UNABORTWARNING
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
|
||||
!ifdef LICENSE_TXT
|
||||
!insertmacro MUI_PAGE_LICENSE "${LICENSE_TXT}"
|
||||
!endif
|
||||
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
!ifdef REG_START_MENU
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${REG_ROOT}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${REG_START_MENU}"
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $SM_Folder
|
||||
!endif
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
######################################################################
|
||||
|
||||
Section -MainProgram
|
||||
${INSTALL_TYPE}
|
||||
|
||||
SetOverwrite ifnewer
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r "install_dir\\"
|
||||
|
||||
; Add the installation folder to the system PATH -> to enable grr.exe
|
||||
ExecWait '$INSTDIR\PathEd.exe add "$INSTDIR"' ; put the path in quotes because of possible spaces
|
||||
|
||||
SectionEnd
|
||||
|
||||
######################################################################
|
||||
|
||||
Section -Icons_Reg
|
||||
SetOutPath "$INSTDIR"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
!ifdef REG_START_MENU
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$SM_Folder"
|
||||
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
||||
|
||||
!ifdef WEB_SITE
|
||||
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
||||
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME} Documentation.lnk" "$INSTDIR\${APP_NAME} website.url"
|
||||
!endif
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
!endif
|
||||
|
||||
!ifndef REG_START_MENU
|
||||
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
|
||||
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe"
|
||||
|
||||
!ifdef WEB_SITE
|
||||
WriteIniStr "$INSTDIR\${APP_NAME} website.url" "InternetShortcut" "URL" "${WEB_SITE}"
|
||||
CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Documentation.lnk" "$INSTDIR\${APP_NAME} website.url"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
|
||||
|
||||
!ifdef WEB_SITE
|
||||
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "URLInfoAbout" "${WEB_SITE}"
|
||||
!endif
|
||||
SectionEnd
|
||||
|
||||
######################################################################
|
||||
|
||||
Section Uninstall
|
||||
${INSTALL_TYPE}
|
||||
|
||||
ExecWait '$INSTDIR\PathEd.exe remove "$INSTDIR"'
|
||||
|
||||
RmDir /r "$INSTDIR"
|
||||
|
||||
!ifdef REG_START_MENU
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
|
||||
Delete "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk"
|
||||
!ifdef WEB_SITE
|
||||
Delete "$SMPROGRAMS\$SM_Folder\${APP_NAME} Documentation.lnk"
|
||||
!endif
|
||||
|
||||
RmDir "$SMPROGRAMS\$SM_Folder"
|
||||
!endif
|
||||
|
||||
!ifndef REG_START_MENU
|
||||
Delete "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk"
|
||||
!ifdef WEB_SITE
|
||||
Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME} Documentation.lnk"
|
||||
!endif
|
||||
|
||||
RmDir "$SMPROGRAMS\${APP_NAME}"
|
||||
!endif
|
||||
|
||||
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
|
||||
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
|
||||
SectionEnd
|
||||
@@ -41,3 +41,62 @@ jobs:
|
||||
args: release --rm-dist ${{ steps.release-notes.outputs.ARGS }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Archive binaries as artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: binaries
|
||||
path: |
|
||||
dist/*
|
||||
|
||||
wininstaller:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
binary: ["kapow_windows_386", "kapow_windows_amd64"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download a single artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: binaries
|
||||
- name: Install NSIS
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --no-install-recommends -y nsis nsis-doc nsis-pluginapi
|
||||
- name: Prepare NSIS files
|
||||
run: |
|
||||
mkdir .github/NSIS/install_dir
|
||||
cp -p ${{ matrix.binary }}/kapow.exe .github/NSIS/install_dir/
|
||||
wget https://github.com/awaescher/PathEd/releases/download/1.0/PathEd.zip
|
||||
unzip PathEd.zip -d .github/NSIS/install_dir/
|
||||
- name: Set variables for the build
|
||||
id: set-vars
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
release="${GITHUB_REF#refs/tags/}"
|
||||
upload_url=$(curl -s -u "$GITHUB_TOKEN" https://api.github.com/repos/nilp0inter/kapow/releases \
|
||||
| jq -r '.[] | if .tag_name == "'$release'" then . else empty end | .upload_url' \
|
||||
| tail -n1)
|
||||
echo ::set-output name=upload_url::$upload_url
|
||||
echo ::set-output name=nsis_version::${release#v}
|
||||
unversioned_binary=${{ matrix.binary }}_setup.exe
|
||||
echo ::set-output name=nsis_installer_name::${unversioned_binary//kapow_/kapow_${release#v}_}
|
||||
- name: Create Windows installer
|
||||
uses: joncloud/makensis-action@v3.4
|
||||
env:
|
||||
NSIS_VERSION: ${{ steps.set-vars.outputs.nsis_version }}
|
||||
NSIS_INSTALLER_NAME: ${{ steps.set-vars.outputs.nsis_installer_name }}
|
||||
with:
|
||||
script-file: .github/NSIS/windows.nsi
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.set-vars.outputs.upload_url }}
|
||||
asset_path: .github/NSIS/${{ steps.set-vars.outputs.nsis_installer_name }}
|
||||
asset_name: ${{ steps.set-vars.outputs.nsis_installer_name }}
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
+1
-1
@@ -55,5 +55,5 @@ dockers:
|
||||
- "bbvalabsci/kapow:v{{ .Major }}"
|
||||
|
||||
release:
|
||||
draft: true
|
||||
draft: false
|
||||
prerelease: auto
|
||||
|
||||
@@ -40,9 +40,12 @@ Install the downloaded binary using the following command as a privileged user.
|
||||
Windows®
|
||||
++++++++
|
||||
|
||||
Unzip the downloaded zipfile and move `kapow.exe` to a directory of your choice;
|
||||
then update the system :envvar:`PATH` variable to include that directory.
|
||||
Note that the zipfile also includes the LICENSE.
|
||||
Native windows installers are provided for both 32 and 64 bit versions.
|
||||
|
||||
Alternatively, you can download the provided zipfile, expand it, and move
|
||||
`kapow.exe` to a directory of your choice; then update the system :envvar:`PATH`
|
||||
variable to include that directory. Note that the zipfile also includes the
|
||||
LICENSE.
|
||||
|
||||
|
||||
Install the package with ``go get``
|
||||
|
||||
Reference in New Issue
Block a user