GitHub Action Workflow for wix / Mission Planner MSI

Hello,

I am looking to create a GitHub Actions workflow in my private Mission Planner repository to create Mission Planner Windows MSI install using wix.

I have a working GitHub Action to build the code from my repository into dlls and exe. This is mostly a copy of the DotNet Build Actions in public Mission Planner.

I am familiar with running manual steps on my laptop to create Mission Planner MSI.

I know there is information available on the Internet for integrating wix with GitHub Actions. I’m sure I can figure it out on my own given enough time and effort. :slight_smile: However…

If anyone has a working GitHub Actions workflow (yaml file) that builds the Mission Planner MSI, and is willing to share it, then that could provide a good starting point.

Regards,
Dave

  - name: msi
    run: |
      pwd
      cd msi
      ./wix.exe ..\bin\release\net461\
      &"${Env:wix}\bin\candle" installer.wxs -ext WiXNetFxExtension -ext WixDifxAppExtension -ext WixUIExtension.dll -ext WixUtilExtension -ext WixIisExtension 
      &"${Env:wix}\bin\light" installer.wixobj "${Env:wix}\bin\difxapp_x86.wixlib" -sval -o MissionPlanner-latest.msi -ext WiXNetFxExtension -ext WixDifxAppExtension -ext WixUIExtension.dll -ext WixUtilExtension -ext WixIisExtension 
  - uses: actions/upload-artifact@v1
    with:
      name: MissionPlannerBetaMSI
      path: msi\MissionPlanner-latest.msi

Thank you Michael for the response.

My apologies, I should have replied earlier that I had it figured out.

Conceptually the same as what you posted. I did include a step to Install Wix Toolset under the assumption it would not be present on the Windows build server by default.

      - name: Install WiX Toolset
        run: dotnet tool install --global wix

      - name: Create Mission Planner Install
        shell: pwsh
        # The wix.exe referenced here is not an exe from the wix toolset. The wix.exe
        # referenced here is created by the Mission Planner build. The wix.exe generates
        # the drivers.wxs, installer.wxs and create.bat files. The create bat file executes
        # the wix toolset's candle and light executables. The wix candle and light
        # executables in combination with the .wxs files then generate the Mission Planner
        # install (.msi file). This pattern of creating wix.exe during the Mission Planner
        # build, and the wix.exe creating .wxs and create.bat files comes from public Mission
        # Planner's build process.
        run: |
          cd ${{ github.workspace }}\MissionPlanner\Msi
          .\net472\wix.exe ..\bin\release\net461\
          .\create.bat

Side note, the scripting in Msi\installer.bat that attempts to cleanup the plugins folder…seemed to fall short of cleaning up all the duplicate DLLs, so I created the following cleanup-plugins-folder.ps1 script.

<#
This PowerShell script is invoked in the .github\main.yml when performing builds on GitHub.

This PowerShell script is also intended to be used by developers when performing local builds.

For an unknown reason, when building Mission Planner dlls and executable, a number of DLLs, as well as other
files that reside under the MissionPlanner folder, or one of the direct subfolders under the MissionPlanner
folder, are duplicated either directly or indirectly under the **plugins** folder. The script in this file
is that which is needed to delete the extraneous files and folders from the folders directly and indirectly
under the plugins folder.

The script in this file replaces the file deletion scripting contained within the installer.bat file from
public Mission Planner. The script in the installer.bat file falls short of deleting all extraneous files
and does not attempt to delete the resulting empty folders.
#>

param (
    [string]$silent = 'false',
    [string]$cleanup_only = 'false'
)

Push-Location bin\Release\net461\plugins

$Curr_Directory = Get-Location
Write-Host "Deleting extraneous files and folders from plugins folder:" -ForegroundColor yellow
Write-Host "    $Curr_Directory" -ForegroundColor yellow

if ($silent -ine 'true') {
    Write-Host "Press Enter key to continue, CTRL+C to cancel." -ForegroundColor green
    Read-Host
}

$Files = Get-ChildItem $Curr_Directory -Recurse -Include *.*

if ($silent -ine 'true') {
    ForEach($F in $Files) { if (Test-Path ($F.FullName -replace '\\plugins\\','\') -PathType Leaf) { Write-Host "File to be deleted:"  $F.FullName }}
    Write-Host "Verify file deletes before continuing." -ForegroundColor yellow
    Write-Host "Press Enter key to continue, CTRL+C to cancel." -ForegroundColor green
    Read-Host
}

ForEach($F in $Files) { if (Test-Path ($F.FullName -replace '\\plugins\\','\') -PathType Leaf) { Write-Host "Delete File:"  $F.FullName; Remove-Item $F.FullName }}
Write-Host "Completed deleting files." -ForegroundColor blue
Write-Host "Press Enter key to continue, CTRL+C to cancel." -ForegroundColor green
Read-Host

$Paths = Get-ChildItem -Path $Curr_Directory -Recurse -Force | where PsIsContainer ; [array]::Reverse($Paths)

if ($silent -ine 'true') {
    ForEach($P in $Paths) { if ((Get-ChildItem -Path $P.FullName -Recurse -File -EA SilentlyContinue | Measure-Object).Count -eq 0){ Write-Host "Folder to be deleted:" $P.FullName }}
    Write-Host "Verify folder deletes before continuing." -ForegroundColor yellow
    Write-Host "Press Enter key to continue, CTRL+C to cancel." -ForegroundColor green
    Read-Host
}

ForEach($P in $Paths) { if ((Get-ChildItem -Path $P.FullName -Recurse -File -EA SilentlyContinue | Measure-Object).Count -eq 0){ Write-Host "Delete Folder:" $P.FullName; Remove-Item $P.FullName }}
Write-Host "Completed deleting folders." -ForegroundColor blue

Pop-Location

And execute the cleanup as part of MS Build Post Processing step in my GitHub workflow…

      - name: Build Mission Planner Executables
        shell: pwsh
        run: |
          $msbuildPath = Split-Path (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\Current\Bin\amd64\MSBuild.exe | Select-Object -First 1) -Parent
          $env:PATH = $msbuildPath + ';' + $env:PATH
          nuget locals all -clear
          msbuild -v:m -restore -t:Build -p:Configuration=Release MissionPlanner\MissionPlanner.sln

      - name: Build Executables Post-Processing
        shell: pwsh
        run: |
          cd ${{ github.workspace }}\MissionPlanner

          .\cleanup-plugins-folder.ps1 -silent true

          cd bin\Release

          .\md5sum.exe net461 > ..\..\checksums.txt