diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90c8fba72d..e8f506675e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -343,7 +343,7 @@ jobs: trusted-signing-account-name: Netdata certificate-profile-name: Netdata files-folder: ${{ github.workspace }}\packaging\windows - files-folder-filter: exe + files-folder-filter: msi file-digest: SHA256 timestamp-rfc3161: "http://timestamp.acs.microsoft.com" timestamp-digest: SHA256 @@ -352,7 +352,7 @@ jobs: uses: actions/upload-artifact@v4.4.2 with: name: windows-x86_64-installer - path: packaging\windows\netdata*.exe + path: packaging\windows\netdata*.msi retention-days: 30 - name: Failure Notification uses: rtCamp/action-slack-notify@v2 diff --git a/.gitignore b/.gitignore index 621ddf6a06..d4b1c020c0 100644 --- a/.gitignore +++ b/.gitignore @@ -196,9 +196,5 @@ build/ src/go/plugin/go.d/bin/ src/go/plugin/go.d/vendor -# ignore nsis installer -packaging/utils/netdata-installer-x64.exe - # ignore files used with msi installer -packaging/utils/*.msi - +packaging/windows/*.msi diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a747d8269..7cf2e5e17f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2468,7 +2468,8 @@ if(OS_WINDOWS) set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc") configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY) - configure_file(packaging/windows/netdata.wxs.in ${CMAKE_SOURCE_DIR}/packaging/windows/netdata.wxs @ONLY) + configure_file(packaging/windows/netdata.wxs.in netdata.wxs @ONLY) + configure_file(packaging/windows/NetdataWhite.ico NetdataWhite.ico COPYONLY) endif() add_executable(netdata diff --git a/packaging/windows/compile-on-windows.sh b/packaging/windows/compile-on-windows.sh index ceb4f5502f..a2c66a2e3a 100755 --- a/packaging/windows/compile-on-windows.sh +++ b/packaging/windows/compile-on-windows.sh @@ -6,7 +6,7 @@ CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}" # shellcheck source=./win-build-dir.sh . "${REPO_ROOT}/packaging/windows/win-build-dir.sh" -set -exu -o pipefail +set -eu -o pipefail if [ -d "${build}" ]; then rm -rf "${build}" diff --git a/packaging/windows/get-win-build-path.sh b/packaging/windows/get-win-build-path.sh new file mode 100755 index 0000000000..0f05f26df3 --- /dev/null +++ b/packaging/windows/get-win-build-path.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +REPO_ROOT="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")" + +# shellcheck source=./win-build-dir.sh +. "${REPO_ROOT}/packaging/windows/win-build-dir.sh" + +cygpath -wa "${build}" diff --git a/packaging/windows/install-dependencies.ps1 b/packaging/windows/install-dependencies.ps1 index 66ec731601..7250e2bcd0 100644 --- a/packaging/windows/install-dependencies.ps1 +++ b/packaging/windows/install-dependencies.ps1 @@ -82,3 +82,24 @@ if ($LastExitcode -ne 0) { exit 1 } } + +Write-Host "Installing WiX toolset" +dotnet tool install -g wix + +if ($LastExitcode -ne 0) { + exit 1 +} + +Write-Host "Adding WiX extensions" + +wix extension -g add WixToolset.Util.wixext + +if ($LastExitcode -ne 0) { + exit 1 +} + +wix extension -g add WixToolset.UI.wixext + +if ($LastExitcode -ne 0) { + exit 1 +} diff --git a/packaging/windows/package-windows.sh b/packaging/windows/package-windows.sh index a2a2cee4a6..a7ab7eeebe 100755 --- a/packaging/windows/package-windows.sh +++ b/packaging/windows/package-windows.sh @@ -2,21 +2,10 @@ repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")" -if [ -n "${BUILD_DIR}" ]; then - build="${BUILD_DIR}" -elif [ -n "${OSTYPE}" ]; then - if [ -n "${MSYSTEM}" ]; then - build="${repo_root}/build-${OSTYPE}-${MSYSTEM}" - else - build="${repo_root}/build-${OSTYPE}" - fi -elif [ "$USER" = "vk" ]; then - build="${repo_root}/build" -else - build="${repo_root}/build" -fi +# shellcheck source=./win-build-dir.sh +. "${repo_root}/packaging/windows/win-build-dir.sh" -set -exu -o pipefail +set -eu -o pipefail # Regenerate keys everytime there is an update if [ -d /opt/netdata/etc/pki/ ]; then @@ -48,13 +37,8 @@ if [ ! -f "/cloud.txt" ]; then fi ${GITHUB_ACTIONS+echo "::endgroup::"} -${GITHUB_ACTIONS+echo "::group::Packaging"} +${GITHUB_ACTIONS+echo "::group::Copy Files"} tar -xf /msys2-latest.tar.zst -C /opt/netdata/ || exit 1 cp -R /opt/netdata/msys64/* /opt/netdata/ || exit 1 rm -rf /opt/netdata/msys64/ -NDVERSION=$"$(grep 'CMAKE_PROJECT_VERSION:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" -NDMAJORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MAJOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" -NDMINORVERSION=$"$(grep 'CMAKE_PROJECT_VERSION_MINOR:STATIC' "${build}/CMakeCache.txt"| cut -d= -f2)" - -/mingw64/bin/makensis.exe -DCURRVERSION="${NDVERSION}" -DMAJORVERSION="${NDMAJORVERSION}" -DMINORVERSION="${NDMINORVERSION}" "${repo_root}/packaging/windows/installer.nsi" ${GITHUB_ACTIONS+echo "::endgroup::"} diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1 index 828e105f1e..15ee29a122 100644 --- a/packaging/windows/package.ps1 +++ b/packaging/windows/package.ps1 @@ -14,3 +14,26 @@ $env:CHERE_INVOKING = 'yes' if ($LastExitcode -ne 0) { exit 1 } + +if ($null -eq $env:BUILD_DIR) { + $builddir = & $msysbash -l "$PSScriptRoot\get-win-build-path.sh" + + if ($LastExitcode -ne 0) { + exit 1 + } +} else { + $builddir = $env:BUILD_DIR +} + +Push-Location "$builddir" + +$wixarch = "x64" + +wix build -arch $wixarch -ext WixToolset.Util.wixext -ext WixToolset.UI.wixext -out "$PSScriptRoot\netdata-$wixarch.msi" netdata.wxs + +if ($LastExitcode -ne 0) { + Pop-Location + exit 1 +} + +Pop-Location diff --git a/packaging/windows/win-build-dir.sh b/packaging/windows/win-build-dir.sh index 09dd6b9772..035ab7d9ff 100644 --- a/packaging/windows/win-build-dir.sh +++ b/packaging/windows/win-build-dir.sh @@ -1,11 +1,7 @@ #!/bin/bash if [ -n "${BUILD_DIR}" ]; then - if (echo "${BUILD_DIR}" | grep -q -E "^[A-Z]:\\\\"); then - build="$(echo "${BUILD_DIR}" | sed -e 's/\\/\//g' -e 's/^\([A-Z]\):\//\/\1\//' -)" - else - build="${BUILD_DIR}" - fi + build="$(cygpath -u "${BUILD_DIR}")" elif [ -n "${OSTYPE}" ]; then if [ -n "${MSYSTEM}" ]; then build="${REPO_ROOT}/build-${OSTYPE}-${MSYSTEM}"