-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (38 loc) · 1004 Bytes
/
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
name: Build
on:
- push
- pull_request
env:
NAME: gobot
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
GOOS: [ windows, linux ]
GOARCH: [ amd64, arm ]
exclude:
- GOOS: windows
GOARCH: arm
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
run: go build -ldflags="-s -w" -o dist/$NAME-$GOOS-$GOARCH
- name: Rename binaries (Windows)
if: matrix.GOOS == 'windows'
run: for x in dist/$NAME-windows-*; do mv $x $x.exe; done
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{env.NAME}}-${{ matrix.GOOS }}-${{ matrix.GOARCH }}-${{github.sha}}
path: dist/*
retention-days: 90