-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (52 loc) · 1.31 KB
/
build.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
name: build
on: push
jobs:
build:
strategy:
matrix:
go-version: [ 1.21.x ]
os: [ ubuntu-latest, macos-latest ]
include:
- os: ubuntu-latest
goos: linux
- os: macos-latest
goos: darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Test
run: go test -v ./...
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: amd64
CGO_ENABLED: '0'
run: go build -a -ldflags='-w -s -extldflags "-static"' -o ./build/tagrelease-$GOOS-$GOARCH
- name: upload build artifact
uses: actions/upload-artifact@v3
with:
name: binaries
path: build/*
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: download build artifacts
uses: actions/download-artifact@v3
with:
name: binaries
path: build
- name: list build artifacts
run: ls -l ./build
- name: publish release
uses: softprops/action-gh-release@v1
with:
files: |
build/*