mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-18 18:49:23 +08:00
ci: 自动构建附件
This commit is contained in:
50
.github/workflows/build.yml
vendored
Normal file
50
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
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 }}*
|
Reference in New Issue
Block a user