name: Windows MSI Installer
on:
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
msi:
name: Build Windows MSI Installer
runs-on: windows-latest
timeout-minutes: 40
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Rust with caching
uses: ./.github/actions/setup-rust-cached
with:
toolchain: stable
cache-key: wix
- name: Install cargo-wix
uses: ./.github/actions/install-cargo-tool
with:
tool: cargo-wix
- name: Build release binary
run: cargo build --release
- name: Create WiX configuration
shell: pwsh
run: |
cargo wix init
# Customize wix/main.wxs if needed
- name: Build MSI installer
run: cargo wix --nocapture
- name: Rename installer
shell: pwsh
run: |
$version = (Get-Content Cargo.toml | Select-String 'version = "(.+)"').Matches.Groups[1].Value
Move-Item target/wix/rust-template-*.msi target/wix/rust-template-$version-x64.msi
- name: Upload MSI artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f with:
name: windows-msi
path: target/wix/*.msi
retention-days: 90
- name: Upload to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b with:
files: target/wix/*.msi