mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-19 02:59:23 +08:00
49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
name: Build and Attach Binaries to Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-and-attach:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
goos: [windows, linux]
|
|
goarch: [amd64, arm64]
|
|
|
|
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
|
|
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" -o $BINARY_NAME
|
|
|
|
- name: Upload binary to release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
BINARY_NAME=komari-agent-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
BINARY_NAME=${BINARY_NAME}.exe
|
|
fi
|
|
gh release upload ${{ github.event.release.tag_name }} $BINARY_NAME --repo ${{ github.repository }}
|
|
shell: bash |