|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | + |
| 3 | +<?ifndef ProductVersion?> |
| 4 | +<?error ProductVersion property not defined?> |
| 5 | +<?endif?> |
| 6 | + |
| 7 | +<!-- Define a unique UpgradeCode per platform --> |
| 8 | +<?if $(var.Platform) = "x64"?> |
| 9 | +<?define InstallerVersion = "200"?> |
| 10 | +<?define UpgradeCode = "8CFB9531-B959-4E1B-AA2E-4AF0FFCC4AF4"?> |
| 11 | +<?define ProgramFilesFolder = "ProgramFiles64Folder"?> |
| 12 | +<?elseif $(var.Platform) = "x86"?> |
| 13 | +<?define InstallerVersion = "200"?> |
| 14 | +<?define UpgradeCode = "767EC5D2-C8F0-4912-9901-45E21F59A284"?> |
| 15 | +<?define ProgramFilesFolder = "ProgramFilesFolder"?> |
| 16 | +<?elseif $(var.Platform) = "arm64"?> |
| 17 | +<?define InstallerVersion = "500"?> |
| 18 | +<?define UpgradeCode = "5D15E95C-F979-41B0-826C-C33C8CB5A7EB"?> |
| 19 | +<?define ProgramFilesFolder = "ProgramFiles64Folder"?> |
| 20 | +<?elseif $(var.Platform) = "arm"?> |
| 21 | +<?define InstallerVersion = "500"?> |
| 22 | +<?define UpgradeCode = "DDDE52AA-42DA-404B-9238-77DC86117CFF"?> |
| 23 | +<?define ProgramFilesFolder = "ProgramFilesFolder"?> |
| 24 | +<?endif?> |
| 25 | + |
| 26 | +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> |
| 27 | + <Product Id="*" Name="GitHub CLI" Version="$(var.ProductVersion)" Language="1033" Manufacturer="GitHub, Inc." UpgradeCode="$(var.UpgradeCode)"> |
| 28 | + <Package Compressed="yes" InstallerVersion="$(var.InstallerVersion)" InstallScope="perMachine"/> |
| 29 | + <MediaTemplate EmbedCab="yes"/> |
| 30 | + |
| 31 | + <!-- Remove older product(s) early but within the transaction --> |
| 32 | + <MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of !(bind.property.ProductName) is already installed."/> |
| 33 | + |
| 34 | + <!-- Upgrade older x86 products --> |
| 35 | + <Upgrade Id="7C0A5736-5B8E-4176-B350-613FA2D8A1B3"> |
| 36 | + <UpgradeVersion Maximum="$(var.ProductVersion)" Property="OLDERX86VERSIONDETECTED"/> |
| 37 | + </Upgrade> |
| 38 | + |
| 39 | + <Directory Id="TARGETDIR" Name="SourceDir"> |
| 40 | + <Directory Id="$(var.ProgramFilesFolder)" Name="Program Files"> |
| 41 | + <Directory Id="INSTALLDIR" Name="GitHub CLI"/> |
| 42 | + </Directory> |
| 43 | + </Directory> |
| 44 | + |
| 45 | + <!-- Restore the INSTALLDIR if previously persisted to the registry --> |
| 46 | + <Property Id="INSTALLDIR"> |
| 47 | + <RegistrySearch Id="InstallDir" Root="HKLM" Key="SOFTWARE\GitHub\CLI" Name="InstallDir" Type="directory"/> |
| 48 | + </Property> |
| 49 | + |
| 50 | + <Feature Id="DefaultFeature" ConfigurableDirectory="INSTALLDIR"> |
| 51 | + <!-- @Guid will be automatically and durably assigned based on key path --> |
| 52 | + <Component Directory="INSTALLDIR"> |
| 53 | + <File Name="gh.exe"/> |
| 54 | + <Environment Id="Path" Action="set" Name="PATH" Part="last" System="yes" Value="[INSTALLDIR]"/> |
| 55 | + </Component> |
| 56 | + |
| 57 | + <!-- Persist the INSTALLDIR and restore it in subsequent installs --> |
| 58 | + <Component Directory="INSTALLDIR"> |
| 59 | + <RegistryValue Root="HKLM" Key="SOFTWARE\GitHub\CLI" Name="InstallDir" Type="string" Value="[INSTALLDIR]"/> |
| 60 | + </Component> |
| 61 | + |
| 62 | + <Component Id="OlderX86Env" Guid="50C15744-A674-404B-873C-6B58957E2A32" Directory="TARGETDIR" Win64="no"> |
| 63 | + <Condition><![CDATA[OLDERX86VERSIONDETECTED]]></Condition> |
| 64 | + |
| 65 | + <!-- Clean up the old x86 package default directory from the user environment --> |
| 66 | + <Environment Id="OlderX86Path" Action="remove" Name="PATH" Part="last" System="no" Value="[ProgramFilesFolder]GitHub CLI\"/> |
| 67 | + </Component> |
| 68 | + </Feature> |
| 69 | + |
| 70 | + <!-- Broadcast environment variable changes --> |
| 71 | + <CustomActionRef Id="WixBroadcastEnvironmentChange" /> |
| 72 | + |
| 73 | + <!-- Use customized WixUI_InstallDir that removes WixUI_LicenseAgreementDlg --> |
| 74 | + <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/> |
| 75 | + <UIRef Id="GitHubCLI_InstallDir"/> |
| 76 | + </Product> |
| 77 | +</Wix> |
0 commit comments