-
Notifications
You must be signed in to change notification settings - Fork 39
57 lines (45 loc) · 1.57 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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 Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
packages: write
env:
GOVERSION: "1.20"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { runner: macos-latest, go-os: darwin, go-arch: amd64, build-tags: netcgo }
- { runner: macos-latest, go-os: darwin, go-arch: arm64, build-tags: netcgo }
- { runner: ubuntu-latest, go-os: linux, go-arch: amd64, }
- { runner: ubuntu-latest, go-os: linux, go-arch: arm64, }
- { runner: windows-latest, go-os: windows, go-arch: amd64, suffix: .exe }
runs-on: ${{ matrix.runner }}
env:
BINARYNAME: ${{github.repository}}-${{matrix.go-os}}-${{matrix.go-arch}}${{matrix.suffix}}
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{env.GOVERSION}}
uses: actions/setup-go@v3
with:
go-version: ${{env.GOVERSION}}
- name: Build
working-directory: ./src
env:
CGO_ENABLED: ${{matrix.go-os == 'windows' && 1 || 0}}
GOOS: ${{matrix.go-os}}
GOARCH: ${{matrix.go-arch}}
run: go build -o "${{env.BINARYNAME}}" -tags="${{ matrix.build-tags }}" -v ./...
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./src/${{env.BINARYNAME}}
tag_name: latest