-
Notifications
You must be signed in to change notification settings - Fork 10
45 lines (42 loc) · 1.54 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
name: Go
on: [push]
jobs:
test:
name: Build
strategy:
matrix:
go: ['1.21']
runs-on: ubuntu-latest
container: golang:${{ matrix.go }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Git Info
id: git
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Test
env:
GOFLAGS: '-mod=vendor'
STATICCHECK_VERSION: '2023.1.6'
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
wget -qO- https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_linux_amd64.tar.gz | tar zxf - --directory /usr/local/bin --strip-components=1 staticcheck/staticcheck
go fmt $(go list ./... | grep -v /vendor/) | xargs -I {} -r /bin/sh -c "/bin/echo {} && exit 1"
go vet $(go list ./... | grep -v /vendor/)
staticcheck --version
staticcheck $(go list ./... | grep -v /vendor/)
go build .
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/') && (matrix.go == '1.21')
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release
# key: ${{ secrets.GPG_CODE_SIGN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}