Skip to content

feat: sync list

feat: sync list #13

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
tags:
- 'v*'
pull_request:
tags:
- 'v*'
jobs:
build-go-binary:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
goos: [linux, windows, darwin] # 需要打包的系统
goarch: [amd64, arm64] # 需要打包的架构
exclude:
# 排除无效组合 (可根据需要调整)
- goos: windows
goarch: arm64 # 如果你不需要 Windows ARM64
- goos: darwin
goarch: amd64 # 如果你不需要 Intel Mac
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Get version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create output directory
run: mkdir -p build/${{ steps.get_version.outputs.version }}
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
EXT: ${{ matrix.goos == 'windows' && '.exe' || '' }}
run: |
OUTPUT="build/${{ steps.get_version.outputs.version }}/Aio-${{ matrix.goos }}-${{ matrix.goarch }}${EXT}"
go build -o "${OUTPUT}" -trimpath -ldflags "-s -w -buildid=" main.go
echo "Built: ${OUTPUT}"
- name: Upload to Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: |
build/${{ steps.get_version.outputs.version }}/*