mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
Introduce a native Windows desktop pairing experience and add ARM64 Windows builds/MSI. Key changes: - Add native Windows UI support: app.manifest, walk/win deps, icons, header image, and foreground activation helpers. - Replace the old local HTTP/webview wizard with a native setup UI (remove wizard.html, refactor setupui). Add setupui.Run integration. - Implement desktop/tray behavior: runDesktop/runTray refactor, single-instance mutex, detached spawn for the pairing wizard, desktop file-backed logging, and MessageBox wrapper for early errors. - Build/CI updates: add windows/arm64 to build matrix, include -H=windowsgui for windows builds, produce per-arch MSI artifacts, and update release workflow summaries. - Packaging & resources: add .syso resources for amd64/arm64, MSI build script updates, icon generation script and packaging tweaks, and update .gitignore to ignore dist and MSI outputs. - Dependency and version bumps: update agent/go.mod/go.sum for walk/win and other indirect deps; bump VERSION to 1.5.4. These changes enable a native pairing wizard on Windows (no browser/WebView2 required), keep the tray visible while the wizard runs, and add ARM64 support end-to-end (binary and MSI installers).
488 lines
17 KiB
YAML
488 lines
17 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:
|
|
build:
|
|
name: Build Agent
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
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: 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"
|
|
|
|
- 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=${{ steps.version.outputs.version }} -X github.com/serverkit/agent/internal/agent.Version=${{ steps.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-${{ steps.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 \
|
|
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 }}-*
|
|
retention-days: 5
|
|
|
|
# Build .deb packages
|
|
build-deb:
|
|
name: Build DEB Package
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, arm64]
|
|
|
|
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 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-${{ steps.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"
|
|
|
|
- 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
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- goarch: amd64
|
|
rpmarch: x86_64
|
|
- goarch: arm64
|
|
rpmarch: aarch64
|
|
|
|
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: 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-${{ steps.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"
|
|
|
|
- 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: build
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- goarch: amd64
|
|
arch: x64
|
|
- goarch: arm64
|
|
arch: arm64
|
|
|
|
steps:
|
|
- 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: 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-${{ steps.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"
|
|
|
|
- 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: build
|
|
|
|
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
|
|
|
|
- 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:${{ steps.version.outputs.version }}
|
|
build-args: |
|
|
VERSION=${{ steps.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]
|
|
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:
|
|
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${{ steps.version.outputs.version }}
|
|
name: ServerKit Agent v${{ steps.version.outputs.version }}
|
|
draft: false
|
|
prerelease: false
|
|
files: |
|
|
release/*
|
|
body: |
|
|
## ServerKit Agent v${{ steps.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 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` |
|
|
|
|
#### 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.
|
|
|
|
#### Docker
|
|
```bash
|
|
docker pull jhd3197/serverkit-agent:${{ steps.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${{ steps.version.outputs.version }}/serverkit-agent_${{ steps.version.outputs.version }}_amd64.deb
|
|
sudo dpkg -i serverkit-agent_${{ steps.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 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:${{ steps.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: [build, build-deb, build-rpm, build-msi, build-docker, 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 "" >> $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${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|