mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-19 02:59:23 +08:00
51 lines
1.3 KiB
YAML
51 lines
1.3 KiB
YAML
name: Build on Main
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
exclude:
|
|
- goos: windows
|
|
goarch: arm
|
|
- goos: darwin
|
|
goarch: 386
|
|
- goos: darwin
|
|
goarch: arm
|
|
goos: [windows, linux, darwin, freebsd]
|
|
goarch: [amd64, arm64, 386, arm]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Build binary
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
CGO_ENABLED: 0
|
|
VERSION: ${{ github.sha }}
|
|
run: |
|
|
BINARY_NAME=komari-agent-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
BINARY_NAME=${BINARY_NAME}.exe
|
|
fi
|
|
go build -trimpath -ldflags="-s -w -X github.com/komari-monitor/komari-agent/update.CurrentVersion=${VERSION}" -o $BINARY_NAME
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: komari-agent-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: komari-agent-${{ matrix.goos }}-${{ matrix.goarch }}*
|