Build MSI #4
This file contains 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 MSI | |
on: | |
workflow_dispatch: | |
inputs: | |
# since this is being triggered manually on branch but we should use our regular git tags when we're back on the normal flow | |
msi_version: | |
description: "MSI package version (e.g., 1.0.0)" | |
required: true | |
jobs: | |
build-msi: | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install GitHub CLI | |
run: | | |
choco install gh --yes | |
# Step 3: Only needed while we provide manual versions | |
- name: Check for existing version | |
shell: bash | |
run: | | |
if gh release view | grep "agent-${{ github.event.inputs.msi_version }}.msi"; then | |
echo "Error: An artifact with version '${{ github.event.inputs.msi_version }}' already exists. Please increment the version." | |
exit 1 | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23.1' | |
- name: Install Make | |
run: choco install make --yes | |
- name: Install WiX 5.0 | |
run: | | |
dotnet tool install --global wix | |
dotnet nuget add source https://nuget.pkg.github.com/wixtoolset/index.json -n wixtoolset | |
dotnet tool install --global WixToolset.Util | |
dotnet tool install --global WixToolset.Firewall | |
- name: Build Go binary | |
run: make windows | |
- name: Build MSI | |
run: | | |
wix build agent.wxs \ | |
--define GoBinDir="${{ github.workspace }}" \ | |
--define MSIProductVersion="${{ github.event.inputs.msi_version }}" \ | |
--ext WixToolset.Util.wixext \ | |
--ext WixToolset.Firewall.wixext \ | |
-o agent-${{ github.event.inputs.msi_version }}.msi | |
- name: Upload MSI artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: agent-${{ github.event.inputs.msi_version }}.msi | |
path: agent-${{ github.event.inputs.msi_version }}.msi |