Skip to content

Commit

Permalink
Add MSI to release
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 authored Jul 28, 2024
1 parent 7c9aab5 commit 4645166
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/buildAndDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,40 @@ jobs:
deploy/Unciv-Windows64.zip
deploy/Unciv-Linux64.zip
build-msi:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4 # For the icon

- name: Download packed zips
uses: actions/download-artifact@v4
with:
name: UncivDeploymentZips

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Unzip unciv file
run: |
tar -xf Unciv-Windows64.zip -C files
dir files
- name: Install WiX
run: dotnet tool install --global wix

- name: Build WiX on Windows
shell: bash
run: |
UNCIV_VERSION=${{ github.ref_name }} wix build .github/workflows/unciv.wxs
- name: Upload MSI
uses: actions/upload-artifact@v4
with:
name: Unciv-MSI
path: Unciv.msi
if-no-files-found: error

upload-to-itch:
runs-on: ubuntu-latest
needs: [packr-build]
Expand Down Expand Up @@ -254,6 +288,7 @@ jobs:
mv UncivDeploymentZips/Unciv-Linux64.zip deploy
mv UncivAPK/Unciv-signed.apk deploy
mv UncivServer/UncivServer.jar deploy
mv Unciv-MSI/Unciv.msi deploy
- name: Check if this is a real release or a test version, for Github release
id: check-version-tag
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/unciv.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- See the file's history at https://github.com/yairm210/unciv-wix-tests -->
<?define Name = "Unciv" ?>
<?define InstallFolder = "Unciv" ?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Language="1033"
Manufacturer="Yair Morgenstern"
Name="$(var.Name)"
Version="$(env.UNCIV_VERSION).0"
UpgradeCode="74d42802-054a-4869-a703-658c361fe94c">
<!-- MSI versions require a 4-part, so we add a ".0" to the end of every version -->
<Icon Id="icon.ico" SourceFile="extraImages/Icons/Unciv.ico"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallInitialize" />

<!-- Pack all the files into the MSI instead of spreading this over .cab files -->
<MediaTemplate CompressionLevel="high" EmbedCab="yes" />

<DirectoryRef Id="INSTALLFOLDER">
<Component Id="Unciv" Guid="70aab056-7fbd-4a7a-9cbb-2275ee064f06">
<File Id="UncivExe"
KeyPath="yes"
Checksum="yes"
Source="files/Unciv.exe">
</File>
</Component>
</DirectoryRef>

<ComponentGroup Id="UncivFiles" Directory="INSTALLFOLDER">
<Files Include="files\**" />
</ComponentGroup>

<Component Id="UncivShortcuts" Directory="INSTALLFOLDER" Guid="0eac8b63-1cab-4645-b0cb-ad7535f0e9ce">
<Shortcut Id="StartMenuShortcut"
Name="$(var.Name)"
Target="[#UncivExe]"
Arguments="--data-dir=%APPDATA%\$(var.InstallFolder)"
Icon="icon.ico"
Directory="ApplicationProgramsFolder"
WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="CleanupStartMenuShortcut"
Directory="ApplicationProgramsFolder"
On="uninstall" />
<RemoveFolder Id="CleanupAppData"
Directory="APPDATAFOLDER"
On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\YairMorgenstern\Unciv" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>

<Feature Id="ProductFeature" Title="$(var.Name)" Level="1" ConfigurableDirectory="INSTALLFOLDER">
<ComponentGroupRef Id="UncivFiles" />
<ComponentRef Id="Unciv" />
<ComponentRef Id="UncivShortcuts" />
</Feature>


<StandardDirectory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.InstallFolder)" />
</StandardDirectory>

<StandardDirectory Id="AppDataFolder">
<Directory Id="APPDATAFOLDER" Name="$(var.InstallFolder)" />
</StandardDirectory>

<StandardDirectory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.InstallFolder)" />
</StandardDirectory>

</Package>
</Wix>

0 comments on commit 4645166

Please sign in to comment.