-
Notifications
You must be signed in to change notification settings - Fork 3
39 lines (32 loc) · 1.22 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
name: Go
on:
push:
tags:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build
run: |
versionflags="-X 'github.com/flant/glaball/pkg/util.Version=$GITHUB_REF_NAME' -X 'github.com/flant/glaball/pkg/util.Revision=$GITHUB_SHA' -X 'github.com/flant/glaball/pkg/util.Branch=$GITHUB_REF_NAME' -X 'github.com/flant/glaball/pkg/util.BuildUser=$GITHUB_ACTOR' -X 'github.com/flant/glaball/pkg/util.BuildDate=$(date +%Y%m%d%H%M)'"
for GOOS in darwin linux windows; do
for GOARCH in amd64 arm64; do
export GOOS GOARCH
CGO_ENABLED=0 go build -v -a -tags netgo -ldflags="-extldflags '-static' -s -w $versionflags" -o build/glaball-${GOOS}-${GOARCH} *.go
if [[ $GOOS == "windows" ]]; then mv build/glaball-${GOOS}-${GOARCH} build/glaball-${GOOS}-${GOARCH}.exe; fi
done
done
cd build; sha256sum * > sha256sums.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
build/*