From fc948ad9632977076a84242b173d5ba6db22099c Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Thu, 21 May 2026 14:10:17 +0200 Subject: [PATCH] =?UTF-8?q?QElectroTech.wxs=20=E2=80=94=20add=20ProductCod?= =?UTF-8?q?e=3D"$(var.ProductCode)"=20to=20=20+=20AllowSameVersio?= =?UTF-8?q?nUpgrades=3D"yes"=20to=20=20windows-msi.yml=20?= =?UTF-8?q?=E2=80=94=20in=20the=20=E2=80=98Extract=20version=E2=80=99=20st?= =?UTF-8?q?ep,=20calculate=20a=20unique=20GUID=20based=20on=20the=20commit?= =?UTF-8?q?=E2=80=99s=20SHA,=20then=20pass=20-d=20=E2=80=98ProductCode=3D$?= =?UTF-8?q?productGuid=E2=80=99=20to=20the=20WIX=20build=20This=20ensures?= =?UTF-8?q?=20that=20each=20build=20will=20have=20a=20different=20ProductC?= =?UTF-8?q?ode=20=E2=86=92=20MajorUpgrade=20will=20always=20be=20triggered?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/windows-msi.yml | 13 +++++++++++++ build-aux/windows/QElectroTech.wxs | 1 + 2 files changed, 14 insertions(+) diff --git a/.github/workflows/windows-msi.yml b/.github/workflows/windows-msi.yml index cef22e7af..205043692 100644 --- a/.github/workflows/windows-msi.yml +++ b/.github/workflows/windows-msi.yml @@ -75,10 +75,20 @@ jobs: $count = git rev-list HEAD --count 2>$null $rev = [int]$count + 473 $verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64" + # Generate a unique ProductCode GUID from the commit SHA + # This ensures MajorUpgrade always triggers, even for same-version builds + $fullSha = git rev-parse HEAD 2>$null + if (-not $fullSha) { $fullSha = [System.Guid]::NewGuid().ToString() } + $bytes = [System.Text.Encoding]::UTF8.GetBytes($fullSha) + $md5 = [System.Security.Cryptography.MD5]::Create().ComputeHash($bytes) + $productGuid = [System.Guid]::new($md5[0..15]).ToString().ToUpper() + echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT + echo "PRODUCT_GUID=$productGuid" >> $env:GITHUB_OUTPUT Write-Host "Version MSI : $verMsi" Write-Host "Version display : $verDisplay" + Write-Host "Product GUID : $productGuid" # ---------------------------------------------------------------- # 4. Install WiX v7, accept EULA and install WixUI extension @@ -202,10 +212,13 @@ jobs: Write-Host " LicenseRtf : $licRtf" Write-Host " Output : dist\$outputName" + $productGuid = "${{ steps.version.outputs.PRODUCT_GUID }}" + wix build $wxs ` -arch x64 ` -d "Version=$version" ` -d "ProductVersion=$verDisplay" ` + -d "ProductCode=$productGuid" ` -d "FilesDir=$filesDir" ` -d "LicenseRtf=$licRtf" ` -ext WixToolset.UI.wixext ` diff --git a/build-aux/windows/QElectroTech.wxs b/build-aux/windows/QElectroTech.wxs index e2666bd93..f2e2bad63 100644 --- a/build-aux/windows/QElectroTech.wxs +++ b/build-aux/windows/QElectroTech.wxs @@ -16,6 +16,7 @@ Name="QElectroTech" Manufacturer="QElectroTech Team" Version="$(var.Version)" + ProductCode="$(var.ProductCode)" UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890" Language="1033" Codepage="1252"