Skip to content

Commit d57ca62

Browse files
Fix YAML syntax and add UI to Windows installer
- Fix YAML indentation error in publish-latest.yml line 132 - Add WixUI_Minimal to show installer progress and completion - Add WixUIExtension and WixUtilExtension to build commands - Add custom exit dialog text about PATH changes - Create test script for local UI testing (test-windows-installer-with-ui.ps1) - Resolves issue where MSI runs silently without user feedback
1 parent 240299e commit d57ca62

File tree

3 files changed

+167
-4
lines changed

3 files changed

+167
-4
lines changed

.github/workflows/build-installers.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ jobs:
4848
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
4949
<MediaTemplate EmbedCab="yes" />
5050
51-
<Feature Id="ProductFeature" Title="Digstore Min" Level="1">
51+
<!-- Add UI -->
52+
<UIRef Id="WixUI_Minimal" />
53+
<UIRef Id="WixUI_ErrorProgressText" />
54+
55+
<!-- Custom completion message -->
56+
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Digstore has been successfully installed. Please restart your terminal or log out and back in for PATH changes to take effect." />
57+
58+
<Feature Id="ProductFeature" Title="Digstore Min" Level="1" Display="expand">
5259
<ComponentGroupRef Id="ProductComponents" />
5360
<ComponentRef Id="Path" />
5461
<ComponentRef Id="ProgramMenuDir" />
@@ -91,8 +98,8 @@ jobs:
9198
9299
# Build MSI installer
93100
cd installer\windows
94-
candle digstore.wxs
95-
light digstore.wixobj -o digstore-windows-x64.msi
101+
candle -ext WixUIExtension digstore.wxs
102+
light -ext WixUIExtension -ext WixUtilExtension digstore.wixobj -o digstore-windows-x64.msi
96103
97104
- name: Upload Windows Installer
98105
uses: actions/upload-artifact@v4

.github/workflows/publish-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128
repo: context.repo.repo,
129129
release_id: release.id,
130130
body: `# Latest Development Build
131-
131+
132132
This release is automatically updated with installers from the latest successful build on the main branch.
133133

134134
**Last Updated:** ${{ steps.date.outputs.date }}

test-windows-installer-with-ui.ps1

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Test Windows Installer with UI
2+
# This creates an MSI with a basic UI
3+
4+
Write-Host "Creating Windows Installer with UI" -ForegroundColor Cyan
5+
Write-Host "===================================" -ForegroundColor Cyan
6+
7+
# Set environment variables
8+
$env:PROJECT_AUTH = "Digstore Contributors"
9+
10+
# Check if we have the binary
11+
if (-not (Test-Path "target\release\digstore.exe")) {
12+
Write-Host "Building release binary..." -ForegroundColor Yellow
13+
cargo build --release
14+
if ($LASTEXITCODE -ne 0) {
15+
Write-Host "Failed to build. Please run 'cargo build --release' first." -ForegroundColor Red
16+
exit 1
17+
}
18+
}
19+
20+
# Check for WiX
21+
$wixPath = "C:\wix"
22+
if (-not (Test-Path "$wixPath\candle.exe")) {
23+
Write-Host "WiX not found at $wixPath" -ForegroundColor Red
24+
Write-Host "Please install WiX first or use the full test script" -ForegroundColor Red
25+
exit 1
26+
}
27+
28+
# Create installer directory
29+
New-Item -ItemType Directory -Force -Path "installer\windows" | Out-Null
30+
31+
# Create WiX source file WITH UI
32+
Write-Host "Creating WiX file with UI..." -ForegroundColor Green
33+
@"
34+
<?xml version="1.0" encoding="UTF-8"?>
35+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
36+
<Product Id="*" Name="Digstore Min" Language="1033" Version="0.1.0"
37+
Manufacturer="$env:PROJECT_AUTH" UpgradeCode="A3F5C8D9-E2B1-F4A6-C9D8-E7F2A5B8C1D4">
38+
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"
39+
Description="Content-addressable storage system with Git-like semantics." />
40+
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
41+
<MediaTemplate EmbedCab="yes" />
42+
43+
<!-- Add UI Reference -->
44+
<UIRef Id="WixUI_InstallDir" />
45+
<UIRef Id="WixUI_ErrorProgressText" />
46+
47+
<!-- Set the default installation directory -->
48+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
49+
50+
<!-- License file (optional - we'll skip it for now) -->
51+
<WixVariable Id="WixUILicenseRtf" Value="installer\windows\license.rtf" Overridable="yes" />
52+
53+
<!-- Custom dialog text -->
54+
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Digstore has been successfully installed. Please restart your terminal or log out and back in for PATH changes to take effect." />
55+
56+
<Feature Id="ProductFeature" Title="Digstore Min" Level="1" Display="expand" ConfigurableDirectory="INSTALLFOLDER">
57+
<ComponentGroupRef Id="ProductComponents" />
58+
<ComponentRef Id="Path" />
59+
<ComponentRef Id="ProgramMenuDir" />
60+
</Feature>
61+
62+
<Directory Id="TARGETDIR" Name="SourceDir">
63+
<Directory Id="ProgramFilesFolder">
64+
<Directory Id="INSTALLFOLDER" Name="Digstore" />
65+
</Directory>
66+
<Directory Id="ProgramMenuFolder" Name="Programs">
67+
<Directory Id="ProgramMenuDir" Name="Digstore Min" />
68+
</Directory>
69+
</Directory>
70+
71+
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
72+
<Component Id="MainExecutable">
73+
<File Id="digstore.exe" Source="..\..\target\release\digstore.exe" KeyPath="yes">
74+
<Shortcut Id="startmenuDigstore" Directory="ProgramMenuDir" Name="Digstore Min"
75+
WorkingDirectory="INSTALLFOLDER" Icon="digstore.exe" IconIndex="0" Advertise="yes" />
76+
</File>
77+
</Component>
78+
</ComponentGroup>
79+
80+
<DirectoryRef Id="TARGETDIR">
81+
<Component Id="Path" Guid="B3F5C8D9-E2B1-F4A6-C9D8-E7F2A5B8C1D5">
82+
<Environment Id="UpdatePath" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" />
83+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="PathComponent" Type="integer" Value="1" KeyPath="yes" />
84+
</Component>
85+
</DirectoryRef>
86+
87+
<Component Id="ProgramMenuDir" Guid="C3F5C8D9-E2B1-F4A6-C9D8-E7F2A5B8C1D6" Directory="ProgramMenuDir">
88+
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
89+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
90+
</Component>
91+
92+
<Icon Id="digstore.exe" SourceFile="..\..\target\release\digstore.exe" />
93+
94+
<!-- Show success message -->
95+
<CustomAction Id="ShowSuccessMessage" Script="vbscript">
96+
<![CDATA[
97+
MsgBox "Digstore has been installed successfully!" & vbCrLf & vbCrLf & _
98+
"Installation location: " & Session.Property("INSTALLFOLDER") & vbCrLf & vbCrLf & _
99+
"Please restart your terminal to use 'digstore' from the command line.", _
100+
vbInformation, "Installation Complete"
101+
]]>
102+
</CustomAction>
103+
104+
<!-- Uncomment to show message after install -->
105+
<!-- <InstallExecuteSequence>
106+
<Custom Action="ShowSuccessMessage" After="InstallFinalize">NOT Installed</Custom>
107+
</InstallExecuteSequence> -->
108+
</Product>
109+
</Wix>
110+
"@ | Out-File -FilePath installer\windows\digstore-ui.wxs -Encoding utf8
111+
112+
# Create a simple license file
113+
@"
114+
Digstore Min - Content-addressable storage system
115+
116+
Copyright (c) 2024 Digstore Contributors
117+
118+
Permission is hereby granted, free of charge, to any person obtaining a copy
119+
of this software and associated documentation files (the "Software"), to deal
120+
in the Software without restriction.
121+
122+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
123+
"@ | Out-File -FilePath installer\windows\license.rtf -Encoding utf8
124+
125+
Write-Host "Compiling installer..." -ForegroundColor Yellow
126+
Push-Location installer\windows
127+
try {
128+
# Compile with UI extensions
129+
& "$wixPath\candle.exe" -ext WixUIExtension digstore-ui.wxs
130+
if ($LASTEXITCODE -ne 0) {
131+
Write-Host "Candle compilation failed" -ForegroundColor Red
132+
exit 1
133+
}
134+
135+
Write-Host "Linking installer..." -ForegroundColor Yellow
136+
& "$wixPath\light.exe" -ext WixUIExtension digstore-ui.wixobj -o digstore-windows-x64-ui.msi
137+
if ($LASTEXITCODE -ne 0) {
138+
Write-Host "Light linking failed" -ForegroundColor Red
139+
exit 1
140+
}
141+
142+
Write-Host "`nSuccess! Installer with UI created at:" -ForegroundColor Green
143+
Write-Host (Resolve-Path "digstore-windows-x64-ui.msi").Path -ForegroundColor Cyan
144+
145+
Write-Host "`nTo test the installer:" -ForegroundColor Yellow
146+
Write-Host "msiexec /i installer\windows\digstore-windows-x64-ui.msi" -ForegroundColor White
147+
148+
} finally {
149+
Pop-Location
150+
}
151+
152+
Write-Host "`nNote: The installer will show:" -ForegroundColor Cyan
153+
Write-Host "- Welcome screen" -ForegroundColor White
154+
Write-Host "- Installation directory selection" -ForegroundColor White
155+
Write-Host "- Progress bar during installation" -ForegroundColor White
156+
Write-Host "- Completion screen" -ForegroundColor White

0 commit comments

Comments
 (0)