wix4 #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build GUI Apps | |
# This workflow builds both Mac and Windows GUI applications | |
on: | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: 'Platform to build' | |
required: true | |
default: 'all' | |
type: choice | |
options: | |
- all | |
- mac | |
- windows | |
skip_signing: | |
description: 'Skip signing (for testing only)' | |
required: false | |
default: false | |
type: boolean | |
push: | |
branches: [ main, master ] | |
tags: | |
- 'v*' | |
- '*.*.*' | |
jobs: | |
build-mac: | |
if: github.event.inputs.platform == 'all' || github.event.inputs.platform == 'mac' || github.event.inputs.platform == null | |
strategy: | |
matrix: | |
os: [macos-13, macos-14] | |
include: | |
- os: macos-13 | |
arch: intel | |
- os: macos-14 | |
arch: arm | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Build Mac App | |
run: | | |
# Make the script executable | |
chmod +x scripts/build_mac_app.sh | |
# Show environment info | |
echo "Python version:" | |
python --version | |
echo "uv version:" | |
uv --version | |
echo "Working directory:" | |
pwd | |
echo "Architecture: ${{ matrix.arch }}" | |
# Run the build script with verbose output | |
./scripts/build_mac_app.sh | |
- name: Sign and Notarize Mac App | |
if: github.event.inputs.skip_signing != 'true' | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | |
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }} | |
APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} | |
APP_STORE_CONNECT_API_ISSUER: ${{ secrets.APP_STORE_CONNECT_API_ISSUER }} | |
run: | | |
# Make the scripts executable | |
chmod +x scripts/sign_mac_app.sh | |
chmod +x scripts/notarize_mac_app.sh | |
chmod +x scripts/create_mac_dmg.sh | |
chmod +x scripts/fix_qt_frameworks.sh | |
chmod +x scripts/fix_qt_bundle_ambiguity.sh | |
# Sign the app (this will rename the app to replace spaces with underscores) | |
echo "Signing the app..." | |
./scripts/sign_mac_app.sh "dist/GetDist GUI.app" | |
# Notarize the app (use the renamed path with underscores) | |
echo "Notarizing the app..." | |
./scripts/notarize_mac_app.sh "dist/GetDist_GUI.app" | |
# Create DMG (use the renamed path with underscores) | |
echo "Creating DMG..." | |
./scripts/create_mac_dmg.sh "dist/GetDist_GUI.app" "dist/GetDist-GUI-${{ matrix.arch }}.dmg" | |
- name: Upload DMG | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GetDist-GUI-DMG-${{ matrix.arch }} | |
path: dist/GetDist-GUI-${{ matrix.arch }}.dmg | |
build-windows: | |
if: github.event.inputs.platform == 'all' || github.event.inputs.platform == 'windows' || github.event.inputs.platform == null | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Build Windows App | |
run: | | |
# Show environment info | |
echo "Python version:" | |
python --version | |
echo "uv version:" | |
uv --version | |
echo "Working directory:" | |
pwd | |
# Run the build script with verbose output | |
./scripts/build_windows_app.bat | |
- name: Sign Windows App | |
if: github.event.inputs.skip_signing != 'true' | |
env: | |
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | |
run: | | |
# Run the signing script | |
python ./scripts/sign_windows_app.py --dir dist/GetDistGUI | |
- name: Install WiX Toolset v4 | |
run: | | |
# Check if WiX is already installed | |
$wixInstalled = $false | |
try { | |
$wixVersion = wix --version | |
$wixInstalled = $true | |
echo "WiX is already installed: $wixVersion" | |
} catch { | |
echo "WiX is not installed, will install now" | |
} | |
# Install WiX if not already installed | |
if (-not $wixInstalled) { | |
echo "Installing WiX v4..." | |
dotnet tool install --global wix --version 6.0.0 | |
# Verify installation succeeded | |
if ($LASTEXITCODE -ne 0) { | |
echo "Failed to install WiX v4" | |
exit 1 | |
} | |
echo "WiX v4 installed successfully" | |
# Note: We don't need to install WiX extensions for our basic MSI installer | |
# If needed in the future, uncomment the line below | |
# dotnet tool install --global WixToolset.Util.wixext | |
} | |
# Display WiX version (should not fail the build if this fails) | |
try { | |
$wixVersion = wix --version | |
echo "WiX v4 is ready to use: $wixVersion" | |
} catch { | |
echo "Warning: Could not get WiX version, but continuing build" | |
} | |
- name: Create MSI Installer with WiX v4 | |
run: | | |
# Verify WiX is available | |
try { | |
$null = Get-Command wix -ErrorAction Stop | |
echo "WiX command is available" | |
} catch { | |
echo "ERROR: WiX v4 is not available. Cannot create MSI installer." | |
exit 1 | |
} | |
# Create MSI installer using WiX v4 | |
echo "Creating MSI installer..." | |
python ./scripts/create_windows_msi.py --input-dir dist/GetDistGUI --output-dir dist | |
# Check if the command succeeded | |
if ($LASTEXITCODE -ne 0) { | |
echo "ERROR: Failed to create MSI installer." | |
exit 1 | |
} | |
# Verify MSI was created | |
$msiFiles = Get-ChildItem -Path dist -Filter "GetDist-GUI-*.msi" | |
if ($msiFiles.Count -eq 0) { | |
echo "ERROR: MSI installer was not created." | |
exit 1 | |
} else { | |
$msiFile = $msiFiles[0].FullName | |
echo "MSI installer created successfully at: $msiFile" | |
} | |
- name: Sign MSI Installer | |
if: github.event.inputs.skip_signing != 'true' | |
env: | |
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | |
run: | | |
# Get the MSI file path | |
$msiFile = Get-ChildItem -Path dist -Filter "GetDist-GUI-*.msi" | Select-Object -First 1 -ExpandProperty FullName | |
echo "Signing MSI installer: $msiFile" | |
# Use our existing signing script with the MSI file | |
python ./scripts/sign_windows_app.py --dir $msiFile | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GetDist-GUI-Windows | |
path: dist/GetDist-GUI-*.msi | |
create-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build-mac, build-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Mac Intel Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: GetDist-GUI-DMG-intel | |
path: artifacts/mac/intel | |
- name: Download Mac ARM Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: GetDist-GUI-DMG-arm | |
path: artifacts/mac/arm | |
- name: Download Windows Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: GetDist-GUI-Windows | |
path: artifacts/windows | |
- name: List Downloaded Artifacts | |
run: | | |
echo "Downloaded artifacts:" | |
find artifacts -type f | sort | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
artifacts/mac/intel/GetDist-GUI-intel.dmg | |
artifacts/mac/arm/GetDist-GUI-arm.dmg | |
artifacts/windows/GetDist-GUI-*.msi | |
draft: true | |
prerelease: false | |
name: GetDist GUI ${{ github.ref_name }} | |
body: | | |
GetDist GUI ${{ github.ref_name }} Release | |
## Downloads | |
- Mac (Intel): GetDist-GUI-intel.dmg | |
- Mac (Apple Silicon): GetDist-GUI-arm.dmg | |
- Windows: GetDist-GUI-*.msi (installer) | |
## Installation | |
- Mac: Open the DMG file and drag the app to your Applications folder | |
- Windows: Run the MSI installer | |