@cryptotaxi247 / netdata-1 / commits / 6cb5e58f6

Update CI to generate MSI installer for Windows using WiX. (#18914)

* Update CI to generate MSI installer for Windows using WiX. * Fix missing option for WiX install. * Copy icon file alongside WiX sources. * Run WiX in the build directory instead of CWD.

Austin S. Hemmelgarn committed Nov 1, 2024 at 12:06 UTC 6cb5e58f60377ec5af7bc9b02767be7c160d218d
9 files changed +63 -34
.github/workflows/build.yml
+2 -2
@@ -343,7 +343,7 @@ jobs:
343 trusted-signing-account-name: Netdata
344 certificate-profile-name: Netdata
345 files-folder: ${{ github.workspace }}\packaging\windows
346 - files-folder-filter: exe
346 + files-folder-filter: msi
347 file-digest: SHA256
348 timestamp-rfc3161: "http://timestamp.acs.microsoft.com"
349 timestamp-digest: SHA256
@@ -352,7 +352,7 @@ jobs:
352 uses: actions/upload-artifact@v4.4.2
353 with:
354 name: windows-x86_64-installer
355 - path: packaging\windows\netdata*.exe
355 + path: packaging\windows\netdata*.msi
356 retention-days: 30
357 - name: Failure Notification
358 uses: rtCamp/action-slack-notify@v2
.gitignore
+1 -5
@@ -196,9 +196,5 @@ build/
196 src/go/plugin/go.d/bin/
197 src/go/plugin/go.d/vendor
198
199 -# ignore nsis installer
200 -packaging/utils/netdata-installer-x64.exe
201 -
199 # ignore files used with msi installer
203 -packaging/utils/*.msi
204 -
200 +packaging/windows/*.msi
CMakeLists.txt
+2 -1
@@ -2468,7 +2468,8 @@ if(OS_WINDOWS)
2468 set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
2469 configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
2470
2471 - configure_file(packaging/windows/netdata.wxs.in ${CMAKE_SOURCE_DIR}/packaging/windows/netdata.wxs @ONLY)
2471 + configure_file(packaging/windows/netdata.wxs.in netdata.wxs @ONLY)
2472 + configure_file(packaging/windows/NetdataWhite.ico NetdataWhite.ico COPYONLY)
2473 endif()
2474
2475 add_executable(netdata
packaging/windows/compile-on-windows.sh
+1 -1
@@ -6,7 +6,7 @@ CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}"
6 # shellcheck source=./win-build-dir.sh
7 . "${REPO_ROOT}/packaging/windows/win-build-dir.sh"
8
9 -set -exu -o pipefail
9 +set -eu -o pipefail
10
11 if [ -d "${build}" ]; then
12 rm -rf "${build}"
packaging/windows/get-win-build-path.sh new
+8
@@ -0,0 +1,8 @@
1 +#!/bin/bash
2 +
3 +REPO_ROOT="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
4 +
5 +# shellcheck source=./win-build-dir.sh
6 +. "${REPO_ROOT}/packaging/windows/win-build-dir.sh"
7 +
8 +cygpath -wa "${build}"
packaging/windows/install-dependencies.ps1
+21
@@ -82,3 +82,24 @@ if ($LastExitcode -ne 0) {
82 exit 1
83 }
84 }
85 +
86 +Write-Host "Installing WiX toolset"
87 +dotnet tool install -g wix
88 +
89 +if ($LastExitcode -ne 0) {
90 + exit 1
91 +}
92 +
93 +Write-Host "Adding WiX extensions"
94 +
95 +wix extension -g add WixToolset.Util.wixext
96 +
97 +if ($LastExitcode -ne 0) {
98 + exit 1
99 +}
100 +
101 +wix extension -g add WixToolset.UI.wixext
102 +
103 +if ($LastExitcode -ne 0) {
104 + exit 1
105 +}
packaging/windows/package-windows.sh
+4 -20
@@ -2,21 +2,10 @@
2
3 repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
4
5 -if [ -n "${BUILD_DIR}" ]; then
6 - build="${BUILD_DIR}"
7 -elif [ -n "${OSTYPE}" ]; then
8 - if [ -n "${MSYSTEM}" ]; then
9 - build="${repo_root}/build-${OSTYPE}-${MSYSTEM}"
10 - else
11 - build="${repo_root}/build-${OSTYPE}"
12 - fi
13 -elif [ "$USER" = "vk" ]; then
14 - build="${repo_root}/build"
15 -else
16 - build="${repo_root}/build"
17 -fi
5 +# shellcheck source=./win-build-dir.sh
6 +. "${repo_root}/packaging/windows/win-build-dir.sh"
7
19 -set -exu -o pipefail
8 +set -eu -o pipefail
9
10 # Regenerate keys everytime there is an update
11 if [ -d /opt/netdata/etc/pki/ ]; then
@@ -48,13 +37,8 @@ if [ ! -f "/cloud.txt" ]; then
37 fi
38 ${GITHUB_ACTIONS+echo "::endgroup::"}
39
51 -${GITHUB_ACTIONS+echo "::group::Packaging"}
40 +${GITHUB_ACTIONS+echo "::group::Copy Files"}
41 tar -xf /msys2-latest.tar.zst -C /opt/netdata/ || exit 1
42 cp -R /opt/netdata/msys64/* /opt/netdata/ || exit 1
43 rm -rf /opt/netdata/msys64/
55 -NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
56 -NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
57 -NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)"
58 -
59 -/mingw64/bin/makensis.exe -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${repo_root}/packaging/windows/installer.nsi"
44 ${GITHUB_ACTIONS+echo "::endgroup::"}
packaging/windows/package.ps1
+23
@@ -14,3 +14,26 @@ $env:CHERE_INVOKING = 'yes'
14 if ($LastExitcode -ne 0) {
15 exit 1
16 }
17 +
18 +if ($null -eq $env:BUILD_DIR) {
19 + $builddir = & $msysbash -l "$PSScriptRoot\get-win-build-path.sh"
20 +
21 + if ($LastExitcode -ne 0) {
22 + exit 1
23 + }
24 +} else {
25 + $builddir = $env:BUILD_DIR
26 +}
27 +
28 +Push-Location "$builddir"
29 +
30 +$wixarch = "x64"
31 +
32 +wix build -arch $wixarch -ext WixToolset.Util.wixext -ext WixToolset.UI.wixext -out "$PSScriptRoot\netdata-$wixarch.msi" netdata.wxs
33 +
34 +if ($LastExitcode -ne 0) {
35 + Pop-Location
36 + exit 1
37 +}
38 +
39 +Pop-Location
packaging/windows/win-build-dir.sh
+1 -5
@@ -1,11 +1,7 @@
1 #!/bin/bash
2
3 if [ -n "${BUILD_DIR}" ]; then
4 - if (echo "${BUILD_DIR}" | grep -q -E "^[A-Z]:\\\\"); then
5 - build="$(echo "${BUILD_DIR}" | sed -e 's/\\/\//g' -e 's/^\([A-Z]\):\//\/\1\//' -)"
6 - else
7 - build="${BUILD_DIR}"
8 - fi
4 + build="$(cygpath -u "${BUILD_DIR}")"
5 elif [ -n "${OSTYPE}" ]; then
6 if [ -n "${MSYSTEM}" ]; then
7 build="${REPO_ROOT}/build-${OSTYPE}-${MSYSTEM}"