Files
ServerKit/.github/workflows/agent-release.yml
T
Juan Denis ba9ec0de8a Fix WiX extension install syntax
Use the correct WiX extension version specifier (wix extension add --global WixToolset.Util.wixext/5.0.2). Updated the GitHub workflow, MSI Product.wxs comments, and PowerShell build script message to use the slash-style version token so the extension installs correctly with wix v5.
2026-06-18 22:48:47 -04:00

471 lines
16 KiB
YAML

name: Agent Release
on:
push:
tags:
- 'agent-v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.0.0)'
required: true
type: string
env:
GO_VERSION: '1.23'
jobs:
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
goarch: amd64
suffix: ''
- goos: linux
goarch: arm64
suffix: ''
- goos: windows
goarch: amd64
suffix: '.exe'
- goos: windows
goarch: arm64
suffix: '.exe'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: agent/go.sum
- name: Download UI artifact
uses: actions/download-artifact@v4
with:
name: agent-ui-dist
path: agent/internal/agentui/dist/
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
cd agent
# Windows builds use -H windowsgui so Start-menu launches don't
# flash a console. attachParentConsole() in cmd/agent restores
# stdio when invoked from PowerShell/cmd for CLI subcommands.
if [ "${{ matrix.goos }}" = "windows" ]; then
EXTRA_LDFLAGS="-H=windowsgui"
else
EXTRA_LDFLAGS=""
fi
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
- name: Compress binary (Linux)
if: matrix.goos == 'linux'
run: |
cd dist
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-${{ 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-${{ needs.version.outputs.version }}-*
retention-days: 5
# Build .deb packages
build-deb:
name: Build DEB Package (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: [version, build-binaries]
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: serverkit-agent-linux-${{ matrix.arch }}
path: dist/
- name: Extract binary
run: |
cd dist
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 "${{ needs.version.outputs.version }}" "${{ matrix.arch }}" "../../../dist/serverkit-agent-linux-${{ matrix.arch }}" "../../../packages"
- name: Upload DEB package
uses: actions/upload-artifact@v4
with:
name: serverkit-agent-deb-${{ matrix.arch }}
path: packages/*.deb
retention-days: 5
# Build .rpm packages
build-rpm:
name: Build RPM Package (${{ matrix.rpmarch }})
runs-on: ubuntu-latest
needs: [version, build-binaries]
strategy:
fail-fast: false
matrix:
include:
- goarch: amd64
rpmarch: x86_64
- goarch: arm64
rpmarch: aarch64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install RPM build tools
run: |
sudo apt-get update
sudo apt-get install -y rpm
- name: Download binary
uses: actions/download-artifact@v4
with:
name: serverkit-agent-linux-${{ matrix.goarch }}
path: dist/
- name: Extract binary
run: |
cd dist
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 "${{ needs.version.outputs.version }}" "${{ matrix.rpmarch }}" "../../../dist/serverkit-agent-linux-${{ matrix.goarch }}" "../../../packages"
- name: Upload RPM package
uses: actions/upload-artifact@v4
with:
name: serverkit-agent-rpm-${{ matrix.rpmarch }}
path: packages/*.rpm
retention-days: 5
# Build Windows MSI installers (one per architecture)
build-msi:
name: Build MSI Installer (${{ matrix.arch }})
runs-on: windows-latest
needs: [version, build-binaries]
strategy:
fail-fast: false
matrix:
include:
- goarch: amd64
arch: x64
- goarch: arm64
arch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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/5.0.2
- name: Download binary
uses: actions/download-artifact@v4
with:
name: serverkit-agent-windows-${{ matrix.goarch }}
path: dist/
- name: Extract binary
shell: bash
run: |
cd dist
unzip serverkit-agent-${{ needs.version.outputs.version }}-windows-${{ matrix.goarch }}.zip
- name: Build MSI
shell: pwsh
run: |
cd agent/packaging/msi
.\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
with:
name: serverkit-agent-msi-${{ matrix.arch }}
path: packages/*.msi
retention-days: 5
# Build Docker image
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
continue-on-error: true
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./agent
platforms: linux/amd64,linux/arm64
push: ${{ secrets.DOCKERHUB_USERNAME != '' }}
tags: |
jhd3197/serverkit-agent:latest
jhd3197/serverkit-agent:${{ needs.version.outputs.version }}
build-args: |
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-binaries, build-deb, build-rpm, build-msi, build-docker]
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
# Binary archives
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec mv {} release/ \;
# DEB packages
find artifacts -type f -name "*.deb" -exec mv {} release/ \;
# RPM packages
find artifacts -type f -name "*.rpm" -exec mv {} release/ \;
# MSI installers
find artifacts -type f -name "*.msi" -exec mv {} release/ \;
ls -la release/
- name: Generate checksums
run: |
cd release
sha256sum * > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
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${{ needs.version.outputs.version }}
### Downloads
#### Binary Archives
| Platform | Architecture | Download |
|----------|--------------|----------|
| 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_${{ 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-${{ needs.version.outputs.version }}-x64.msi` |
| MSI | ARM64 | `serverkit-agent-${{ needs.version.outputs.version }}-arm64.msi` |
#### Docker
```bash
docker pull jhd3197/serverkit-agent:${{ needs.version.outputs.version }}
docker pull jhd3197/serverkit-agent:latest
```
### Quick Install
**Debian/Ubuntu:**
```bash
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${{ 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
```
**Windows (MSI):**
Download and run the MSI installer, then:
```powershell
serverkit-agent register --token "YOUR_TOKEN" --server "https://your-serverkit.com"
Start-Service ServerKitAgent
```
**Docker:**
```bash
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:${{ needs.version.outputs.version }}
```
### Verification
Verify downloads using the checksums in `checksums.txt`:
```bash
sha256sum -c checksums.txt
```
### What's New
See [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/agent/CHANGELOG.md) for details.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
summary:
name: Build Summary
runs-on: ubuntu-latest
needs: [version, release]
steps:
- name: Create summary
run: |
echo "## Agent Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $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
echo "| Platform | Architecture | Status |" >> $GITHUB_STEP_SUMMARY
echo "|----------|--------------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Linux | amd64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| Linux | arm64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| Windows | amd64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Packages" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Format | Architecture | Status |" >> $GITHUB_STEP_SUMMARY
echo "|--------|--------------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| DEB | amd64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| DEB | arm64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| RPM | x86_64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| RPM | aarch64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| MSI | x64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| MSI | ARM64 | ✅ Built |" >> $GITHUB_STEP_SUMMARY
echo "| Docker | multi-arch | ✅ Built |" >> $GITHUB_STEP_SUMMARY
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${{ needs.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY