Wix Installer from Github Action

June 18, 2022

I wanted to build a Wix installer for my Windows application from a github action, and I faced all sorts of trouble trying to get it to work. I eventually ended up with the following:

   - name: Build Installer
      shell: bash
        WIX_PATH_CANDLE: "C:/Program Files (x86)/WiX Toolset v3.11/bin/candle.exe"
        WIX_PATH_LIGHT: "C:/Program Files (x86)/WiX Toolset v3.11/bin/light.exe"
      run: |
        mkdir wixout
        "$WIX_PATH_CANDLE" Product.wxs -o wixout/ -ext WixUtilExtension -ext WixUIExtension
        "$WIX_PATH_LIGHT" wixout/*.wixobj -o Installer.msi -ext WixUtilExtension -ext WixUIExtension
        git_hash=$(git rev-parse --short "$GITHUB_SHA")
        mv Installer.msi MyApplication-$(date +'%Y-%m-%d')-${git_hash}.msi