From 9fdfb4e43567533ccafa39642e434f39b584b7d9 Mon Sep 17 00:00:00 2001 From: Ale Paredes <1709578+ale7714@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:05:09 -0500 Subject: [PATCH] Add msi (#58) --- .github/workflows/build-msi.yaml | 46 ++++++++++++++++++++++++++++++++ Makefile | 3 +-- agent.wxs | 28 +++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-msi.yaml create mode 100644 agent.wxs diff --git a/.github/workflows/build-msi.yaml b/.github/workflows/build-msi.yaml new file mode 100644 index 0000000..8384a92 --- /dev/null +++ b/.github/workflows/build-msi.yaml @@ -0,0 +1,46 @@ +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@v4 + + - 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 CLI + run: dotnet tool install --global wix + + - name: Install WiX Extensions + run: | + wix extension add -g WixToolset.Firewall.wixext/5.0.2 + wix extension add -g WixToolset.Util.wixext/5.0.2 + + - name: Build Go binary + run: make windows + + - name: Build MSI + run: | + wix build agent.wxs -define GoBinDir="${{ github.workspace }}\bin" -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@v4 + with: + name: agent-${{ github.event.inputs.msi_version }}.msi + path: agent-${{ github.event.inputs.msi_version }}.msi diff --git a/Makefile b/Makefile index 0c37091..7501008 100644 --- a/Makefile +++ b/Makefile @@ -37,12 +37,11 @@ bin/viam-agent-$(PATH_VERSION)-$(LINUX_ARCH): go.* *.go */*.go */*/*.go subsyste go build -o $@ -trimpath -tags $(TAGS) -ldflags $(LDFLAGS) ./cmd/viam-agent/main.go test "$(PATH_VERSION)" != "custom" && cp $@ bin/viam-agent-stable-$(LINUX_ARCH) || true +.PHONY: windows windows: bin/viam-agent.exe bin/viam-agent.exe: GOOS=windows GOARCH=amd64 go build -o $@ -trimpath -tags $(TAGS) -ldflags $(LDFLAGS) ./cmd/viam-agent - file $@ - du -hc $@ .PHONY: clean clean: diff --git a/agent.wxs b/agent.wxs new file mode 100644 index 0000000..8322143 --- /dev/null +++ b/agent.wxs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +