Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Split agent CI: build UI & resolve version

Juan Denis428dc58f0953
diff --git a/.github/workflows/agent-ci.yml b/.github/workflows/agent-ci.yml
index 275b46a8..102ad0e3 100644
--- a/.github/workflows/agent-ci.yml
+++ b/.github/workflows/agent-ci.yml
@@ -18,20 +18,12 @@ on:
- 'agent/**'
- '.github/workflows/agent-ci.yml'
-defaults:
- run:
- working-directory: agent
-
jobs:
- test:
- name: vet & test (linux)
+ build-ui:
+ name: Build Agent UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: actions/setup-go@v5
- with:
- go-version-file: agent/go.mod
- cache-dependency-path: agent/go.sum
# The agent embeds the desktop UI via //go:embed all:dist, so the
# React app must be built into agent/internal/agentui/dist before any
# `go` command — otherwise the embed fails with "no matching files".
@@ -40,9 +32,33 @@ jobs:
node-version: '20'
cache: 'npm'
cache-dependency-path: agent/ui/package-lock.json
- - name: Build agent UI (required by //go:embed)
+ - name: Build agent UI
working-directory: agent/ui
run: npm ci && npm run build
+ - name: Upload UI artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: agent-ui-dist
+ path: agent/internal/agentui/dist/
+ retention-days: 1
+
+ test:
+ name: vet & test (linux)
+ runs-on: ubuntu-latest
+ needs: build-ui
+ defaults:
+ run:
+ working-directory: agent
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-go@v5
+ with:
+ go-version-file: agent/go.mod
+ cache-dependency-path: agent/go.sum
+ - uses: actions/download-artifact@v4
+ with:
+ name: agent-ui-dist
+ path: agent/internal/agentui/dist/
- name: go vet
run: go vet ./...
- name: go test
@@ -51,6 +67,10 @@ jobs:
build:
name: build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
+ needs: build-ui
+ defaults:
+ run:
+ working-directory: agent
# darwin is intentionally NOT in this matrix: the tray dependency
# (fyne.io/systray) needs the macOS Cocoa toolchain and cannot be
# cross-compiled from Linux. It is built on a macOS host at release time
@@ -72,16 +92,10 @@ jobs:
with:
go-version-file: agent/go.mod
cache-dependency-path: agent/go.sum
- # Build the embedded desktop UI before `go build` (see //go:embed
- # all:dist in internal/agentui/embed.go).
- - uses: actions/setup-node@v4
+ - uses: actions/download-artifact@v4
with:
- node-version: '20'
- cache: 'npm'
- cache-dependency-path: agent/ui/package-lock.json
- - name: Build agent UI (required by //go:embed)
- working-directory: agent/ui
- run: npm ci && npm run build
+ name: agent-ui-dist
+ path: agent/internal/agentui/dist/
- name: go build
env:
GOOS: ${{ matrix.goos }}
diff --git a/.github/workflows/agent-release.yml b/.github/workflows/agent-release.yml
index 6e722481..38400397 100644
--- a/.github/workflows/agent-release.yml
+++ b/.github/workflows/agent-release.yml
@@ -15,11 +15,58 @@ env:
GO_VERSION: '1.23'
jobs:
- build:
- name: Build Agent
+ version:
+ name: Resolve Version
runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.version.outputs.version }}
+ steps:
+ - name: Get version
+ id: version
+ run: |
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ VERSION="${{ github.event.inputs.version }}"
+ else
+ VERSION="${GITHUB_REF#refs/tags/agent-v}"
+ fi
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "Releasing agent version: $VERSION"
+
+ build-ui:
+ name: Build Agent UI
+ runs-on: ubuntu-latest
+ needs: version
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ # The agent embeds its desktop UI via //go:embed all:dist, so the React
+ # app must be built into agent/internal/agentui/dist before `go build`.
+ - name: Set up Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: agent/ui/package-lock.json
+
+ - name: Build agent UI
+ working-directory: agent/ui
+ run: npm ci && npm run build
+
+ - name: Upload UI artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: agent-ui-dist
+ path: agent/internal/agentui/dist/
+ retention-days: 5
+
+ build-binaries:
+ name: Build Binary (${{ matrix.goos }}/${{ matrix.goarch }})
+ runs-on: ubuntu-latest
+ needs: [version, build-ui]
strategy:
+ fail-fast: false
matrix:
include:
- goos: linux
@@ -45,29 +92,11 @@ jobs:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: agent/go.sum
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
- echo "Building version: $VERSION"
-
- # The agent embeds its desktop UI via //go:embed all:dist, so the React
- # app must be built into agent/internal/agentui/dist before `go build`.
- - name: Set up Node
- uses: actions/setup-node@v4
+ - name: Download UI artifact
+ uses: actions/download-artifact@v4
with:
- node-version: '20'
- cache: 'npm'
- cache-dependency-path: agent/ui/package-lock.json
-
- - name: Build agent UI (required by //go:embed)
- working-directory: agent/ui
- run: npm ci && npm run build
+ name: agent-ui-dist
+ path: agent/internal/agentui/dist/
- name: Build binary
env:
@@ -84,7 +113,7 @@ jobs:
else
EXTRA_LDFLAGS=""
fi
- go build -ldflags="-s -w $EXTRA_LDFLAGS -X main.Version=${{ steps.version.outputs.version }} -X github.com/serverkit/agent/internal/agent.Version=${{ steps.version.outputs.version }}" \
+ go build -ldflags="-s -w $EXTRA_LDFLAGS -X main.Version=${{ needs.version.outputs.version }} -X github.com/serverkit/agent/internal/agent.Version=${{ needs.version.outputs.version }}" \
-o ../dist/serverkit-agent-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} \
./cmd/agent
@@ -92,30 +121,31 @@ jobs:
if: matrix.goos == 'linux'
run: |
cd dist
- tar -czvf serverkit-agent-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
+ tar -czvf serverkit-agent-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
serverkit-agent-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Compress binary (Windows)
if: matrix.goos == 'windows'
run: |
cd dist
- zip serverkit-agent-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip \
+ zip serverkit-agent-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip \
serverkit-agent-${{ matrix.goos }}-${{ matrix.goarch }}.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: serverkit-agent-${{ matrix.goos }}-${{ matrix.goarch }}
- path: dist/serverkit-agent-${{ steps.version.outputs.version }}-*
+ path: dist/serverkit-agent-${{ needs.version.outputs.version }}-*
retention-days: 5
# Build .deb packages
build-deb:
- name: Build DEB Package
+ name: Build DEB Package (${{ matrix.arch }})
runs-on: ubuntu-latest
- needs: build
+ needs: [version, build-binaries]
strategy:
+ fail-fast: false
matrix:
arch: [amd64, arm64]
@@ -123,16 +153,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Download binary
uses: actions/download-artifact@v4
with:
@@ -142,13 +162,13 @@ jobs:
- name: Extract binary
run: |
cd dist
- tar -xzf serverkit-agent-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz
+ tar -xzf serverkit-agent-${{ needs.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz
- name: Build DEB package
run: |
chmod +x agent/packaging/deb/build.sh
cd agent/packaging/deb
- ./build.sh "${{ steps.version.outputs.version }}" "${{ matrix.arch }}" "../../../dist/serverkit-agent-linux-${{ matrix.arch }}" "../../../packages"
+ ./build.sh "${{ needs.version.outputs.version }}" "${{ matrix.arch }}" "../../../dist/serverkit-agent-linux-${{ matrix.arch }}" "../../../packages"
- name: Upload DEB package
uses: actions/upload-artifact@v4
@@ -159,11 +179,12 @@ jobs:
# Build .rpm packages
build-rpm:
- name: Build RPM Package
+ name: Build RPM Package (${{ matrix.rpmarch }})
runs-on: ubuntu-latest
- needs: build
+ needs: [version, build-binaries]
strategy:
+ fail-fast: false
matrix:
include:
- goarch: amd64
@@ -175,16 +196,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Install RPM build tools
run: |
sudo apt-get update
@@ -199,13 +210,13 @@ jobs:
- name: Extract binary
run: |
cd dist
- tar -xzf serverkit-agent-${{ steps.version.outputs.version }}-linux-${{ matrix.goarch }}.tar.gz
+ tar -xzf serverkit-agent-${{ needs.version.outputs.version }}-linux-${{ matrix.goarch }}.tar.gz
- name: Build RPM package
run: |
chmod +x agent/packaging/rpm/build.sh
cd agent/packaging/rpm
- ./build.sh "${{ steps.version.outputs.version }}" "${{ matrix.rpmarch }}" "../../../dist/serverkit-agent-linux-${{ matrix.goarch }}" "../../../packages"
+ ./build.sh "${{ needs.version.outputs.version }}" "${{ matrix.rpmarch }}" "../../../dist/serverkit-agent-linux-${{ matrix.goarch }}" "../../../packages"
- name: Upload RPM package
uses: actions/upload-artifact@v4
@@ -218,9 +229,10 @@ jobs:
build-msi:
name: Build MSI Installer (${{ matrix.arch }})
runs-on: windows-latest
- needs: build
+ needs: [version, build-binaries]
strategy:
+ fail-fast: false
matrix:
include:
- goarch: amd64
@@ -232,24 +244,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- - name: Get version
- id: version
- shell: bash
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Install WiX Toolset
run: |
dotnet tool install --global wix --version 5.0.2
- name: Install WiX Util extension
run: |
- wix extension add --global WixToolset.Util.wixext
+ wix extension add --global WixToolset.Util.wixext --version 5.0.2
- name: Download binary
uses: actions/download-artifact@v4
@@ -261,13 +262,13 @@ jobs:
shell: bash
run: |
cd dist
- unzip serverkit-agent-${{ steps.version.outputs.version }}-windows-${{ matrix.goarch }}.zip
+ unzip serverkit-agent-${{ needs.version.outputs.version }}-windows-${{ matrix.goarch }}.zip
- name: Build MSI
shell: pwsh
run: |
cd agent/packaging/msi
- .\build.ps1 -Version "${{ steps.version.outputs.version }}" -Arch "${{ matrix.arch }}" -BinaryPath "..\..\..\dist\serverkit-agent-windows-${{ matrix.goarch }}.exe" -OutputDir "..\..\..\packages"
+ .\build.ps1 -Version "${{ needs.version.outputs.version }}" -Arch "${{ matrix.arch }}" -BinaryPath "..\..\..\dist\serverkit-agent-windows-${{ matrix.goarch }}.exe" -OutputDir "..\..\..\packages"
- name: Upload MSI
uses: actions/upload-artifact@v4
@@ -280,22 +281,12 @@ jobs:
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
- needs: build
+ needs: version
steps:
- name: Checkout code
uses: actions/checkout@v4
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -317,33 +308,20 @@ jobs:
push: ${{ secrets.DOCKERHUB_USERNAME != '' }}
tags: |
jhd3197/serverkit-agent:latest
- jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
+ jhd3197/serverkit-agent:${{ needs.version.outputs.version }}
build-args: |
- VERSION=${{ steps.version.outputs.version }}
+ VERSION=${{ needs.version.outputs.version }}
BUILD_TIME=${{ github.event.repository.updated_at }}
GIT_COMMIT=${{ github.sha }}
release:
name: Create Release
runs-on: ubuntu-latest
- needs: [build, build-deb, build-rpm, build-msi, build-docker]
+ needs: [build-binaries, build-deb, build-rpm, build-msi, build-docker]
permissions:
contents: write
steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
@@ -371,44 +349,42 @@ jobs:
- name: Create Release
uses: softprops/action-gh-release@v1
with:
- tag_name: agent-v${{ steps.version.outputs.version }}
- name: ServerKit Agent v${{ steps.version.outputs.version }}
+ tag_name: agent-v${{ needs.version.outputs.version }}
+ name: ServerKit Agent v${{ needs.version.outputs.version }}
draft: false
prerelease: false
files: |
release/*
body: |
- ## ServerKit Agent v${{ steps.version.outputs.version }}
+ ## ServerKit Agent v${{ needs.version.outputs.version }}
### Downloads
#### Binary Archives
| Platform | Architecture | Download |
|----------|--------------|----------|
- | Linux | x64 (amd64) | `serverkit-agent-${{ steps.version.outputs.version }}-linux-amd64.tar.gz` |
- | Linux | ARM64 | `serverkit-agent-${{ steps.version.outputs.version }}-linux-arm64.tar.gz` |
- | Windows | x64 (amd64) | `serverkit-agent-${{ steps.version.outputs.version }}-windows-amd64.zip` |
- | Windows | ARM64 | `serverkit-agent-${{ steps.version.outputs.version }}-windows-arm64.zip` |
+ | Linux | x64 (amd64) | `serverkit-agent-${{ needs.version.outputs.version }}-linux-amd64.tar.gz` |
+ | Linux | ARM64 | `serverkit-agent-${{ needs.version.outputs.version }}-linux-arm64.tar.gz` |
+ | Windows | x64 (amd64) | `serverkit-agent-${{ needs.version.outputs.version }}-windows-amd64.zip` |
+ | Windows | ARM64 | `serverkit-agent-${{ needs.version.outputs.version }}-windows-arm64.zip` |
#### Linux Packages
| Format | Architecture | Download |
|--------|--------------|----------|
- | DEB (Debian/Ubuntu) | amd64 | `serverkit-agent_${{ steps.version.outputs.version }}_amd64.deb` |
- | DEB (Debian/Ubuntu) | arm64 | `serverkit-agent_${{ steps.version.outputs.version }}_arm64.deb` |
- | RPM (RHEL/Fedora) | x86_64 | `serverkit-agent-${{ steps.version.outputs.version }}-1.x86_64.rpm` |
- | RPM (RHEL/Fedora) | aarch64 | `serverkit-agent-${{ steps.version.outputs.version }}-1.aarch64.rpm` |
+ | DEB (Debian/Ubuntu) | amd64 | `serverkit-agent_${{ needs.version.outputs.version }}_amd64.deb` |
+ | DEB (Debian/Ubuntu) | arm64 | `serverkit-agent_${{ needs.version.outputs.version }}_arm64.deb` |
+ | RPM (RHEL/Fedora) | x86_64 | `serverkit-agent-${{ needs.version.outputs.version }}-1.x86_64.rpm` |
+ | RPM (RHEL/Fedora) | aarch64 | `serverkit-agent-${{ needs.version.outputs.version }}-1.aarch64.rpm` |
#### Windows Installer
| Format | Architecture | Download |
- |--------|--------------|----------|
- | MSI | x64 | `serverkit-agent-${{ steps.version.outputs.version }}-x64.msi` |
- | MSI | ARM64 | `serverkit-agent-${{ steps.version.outputs.version }}-arm64.msi` |
-
- > **New:** The Windows MSI now opens a native pairing wizard right after install — no browser, no WebView2 runtime needed. The Start-menu shortcut and login autostart both run the unified desktop app: pairing wizard if not yet configured, otherwise the system tray.
+ |--------|--------------|--------|
+ | MSI | x64 | `serverkit-agent-${{ needs.version.outputs.version }}-x64.msi` |
+ | MSI | ARM64 | `serverkit-agent-${{ needs.version.outputs.version }}-arm64.msi` |
#### Docker
```bash
- docker pull jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
+ docker pull jhd3197/serverkit-agent:${{ needs.version.outputs.version }}
docker pull jhd3197/serverkit-agent:latest
```
@@ -416,15 +392,15 @@ jobs:
**Debian/Ubuntu:**
```bash
- curl -LO https://github.com/${{ github.repository }}/releases/download/agent-v${{ steps.version.outputs.version }}/serverkit-agent_${{ steps.version.outputs.version }}_amd64.deb
- sudo dpkg -i serverkit-agent_${{ steps.version.outputs.version }}_amd64.deb
+ curl -LO https://github.com/${{ github.repository }}/releases/download/agent-v${{ needs.version.outputs.version }}/serverkit-agent_${{ needs.version.outputs.version }}_amd64.deb
+ sudo dpkg -i serverkit-agent_${{ needs.version.outputs.version }}_amd64.deb
sudo serverkit-agent register --token "YOUR_TOKEN" --server "https://your-serverkit.com"
sudo systemctl start serverkit-agent
```
**RHEL/Fedora:**
```bash
- sudo rpm -i https://github.com/${{ github.repository }}/releases/download/agent-v${{ steps.version.outputs.version }}/serverkit-agent-${{ steps.version.outputs.version }}-1.x86_64.rpm
+ sudo rpm -i https://github.com/${{ github.repository }}/releases/download/agent-v${{ needs.version.outputs.version }}/serverkit-agent-${{ needs.version.outputs.version }}-1.x86_64.rpm
sudo serverkit-agent register --token "YOUR_TOKEN" --server "https://your-serverkit.com"
sudo systemctl start serverkit-agent
```
@@ -441,7 +417,7 @@ jobs:
docker run -d --name serverkit-agent \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v serverkit-config:/etc/serverkit-agent \
- jhd3197/serverkit-agent:${{ steps.version.outputs.version }}
+ jhd3197/serverkit-agent:${{ needs.version.outputs.version }}
```
### Verification
@@ -460,24 +436,14 @@ jobs:
summary:
name: Build Summary
runs-on: ubuntu-latest
- needs: [build, build-deb, build-rpm, build-msi, build-docker, release]
+ needs: [version, release]
steps:
- - name: Get version
- id: version
- run: |
- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
- VERSION="${{ github.event.inputs.version }}"
- else
- VERSION="${GITHUB_REF#refs/tags/agent-v}"
- fi
- echo "version=$VERSION" >> $GITHUB_OUTPUT
-
- name: Create summary
run: |
echo "## Agent Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- echo "**Version:** v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
+ echo "**Version:** v${{ needs.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Built Binaries" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
@@ -501,4 +467,4 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Release" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- echo "Release created at: https://github.com/${{ github.repository }}/releases/tag/agent-v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
+ echo "Release created at: https://github.com/${{ github.repository }}/releases/tag/agent-v${{ needs.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
diff --git a/agent/Makefile b/agent/Makefile
index 8eb98fb4..4d68f196 100644
--- a/agent/Makefile
+++ b/agent/Makefile
@@ -22,8 +22,10 @@ WINDOWS_LDFLAGS := $(AGENT_LDFLAGS) -H=windowsgui
BINARY_NAME := serverkit-agent
DIST_DIR := dist
+UI_DIR := ui
+UI_DIST := internal/agentui/dist
-.PHONY: all build clean test lint deps dev run docker-build docker-push docker-buildx
+.PHONY: all build clean test lint deps dev run docker-build docker-push docker-buildx build-ui
all: build
@@ -32,8 +34,14 @@ deps:
go mod download
go mod tidy
+# Build the embedded React UI (required by //go:embed in internal/agentui/embed.go)
+build-ui:
+ @cd $(UI_DIR) && npm ci && npm run build
+
+$(UI_DIST): build-ui
+
# Build for current platform
-build:
+build: $(UI_DIST)
CGO_ENABLED=0 go build -ldflags "$(AGENT_LDFLAGS)" -o $(BINARY_NAME) ./cmd/agent
# Build for current platform with debug symbols
@@ -45,7 +53,7 @@ run: build
./$(BINARY_NAME) start
# Build for all platforms
-build-all:
+build-all: $(UI_DIST)
@mkdir -p $(DIST_DIR)
@echo "Building for Linux amd64..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(AGENT_LDFLAGS)" -o $(DIST_DIR)/$(BINARY_NAME)-$(VERSION)-linux-amd64 ./cmd/agent
@@ -62,13 +70,13 @@ build-all:
@echo "Done! Binaries in $(DIST_DIR)/"
# Build Linux only
-build-linux:
+build-linux: $(UI_DIST)
@mkdir -p $(DIST_DIR)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(AGENT_LDFLAGS)" -o $(DIST_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/agent
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$(AGENT_LDFLAGS)" -o $(DIST_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/agent
# Build Windows only
-build-windows:
+build-windows: $(UI_DIST)
@mkdir -p $(DIST_DIR)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(WINDOWS_LDFLAGS)" -o $(DIST_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/agent
@@ -93,6 +101,7 @@ fmt:
clean:
rm -f $(BINARY_NAME)
rm -rf $(DIST_DIR)
+ rm -rf $(UI_DIST)
rm -f coverage.out coverage.html
# Install locally
diff --git a/agent/packaging/msi/Product.wxs b/agent/packaging/msi/Product.wxs
index 4dcc1e16..ac83929d 100644
--- a/agent/packaging/msi/Product.wxs
+++ b/agent/packaging/msi/Product.wxs
@@ -5,7 +5,9 @@
Build instructions:
1. Install WiX Toolset v5
- 2. Install the Util extension: wix extension add --global WixToolset.Util.wixext
+ dotnet tool install --global wix --version 5.0.2
+ 2. Install the matching Util extension:
+ wix extension add --global WixToolset.Util.wixext --version 5.0.2
3. Run: wix build Product.wxs -ext WixToolset.Util.wixext -o serverkit-agent.msi -define Version=1.0.0
-->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
diff --git a/agent/packaging/msi/build.ps1 b/agent/packaging/msi/build.ps1
index f2719c92..b4974c8c 100644
--- a/agent/packaging/msi/build.ps1
+++ b/agent/packaging/msi/build.ps1
@@ -20,11 +20,20 @@ Write-Host " Binary: $BinaryPath"
$wixPath = Get-Command wix -ErrorAction SilentlyContinue
if (-not $wixPath) {
Write-Host "WiX Toolset not found. Please install it first:"
- Write-Host " winget install WixToolset.WixToolset"
+ Write-Host " dotnet tool install --global wix --version 5.0.2"
Write-Host " or download from: https://wixtoolset.org/"
exit 1
}
+# The Product.wxs file requires the WiX Util extension. Verify it is installed
+# so the failure message is actionable instead of the raw WiX WIX0144 error.
+$extensionList = wix extension list --global 2>&1
+if (-not ($extensionList -match "WixToolset\.Util\.wixext")) {
+ Write-Host "WiX Util extension not found. Install it with:"
+ Write-Host " wix extension add --global WixToolset.Util.wixext --version 5.0.2"
+ exit 1
+}
+
# Create build directory
$buildDir = New-Item -ItemType Directory -Force -Path "$env:TEMP\serverkit-msi-build-$(Get-Random)"
Write-Host "Build directory: $buildDir"