1
+ name : release
2
+ on : [push, pull_request]
3
+ jobs :
4
+ test :
5
+ strategy :
6
+ matrix :
7
+ go-version : [ 1.16.x, 1.17.x ]
8
+ os : [ ubuntu-latest, macos-latest, windows-latest ]
9
+ runs-on : ${{ matrix.os }}
10
+ steps :
11
+ - name : Install Go
12
+ uses : actions/setup-go@v2
13
+ with :
14
+ go-version : ${{ matrix.go-version }}
15
+ - name : Checkout code
16
+ uses : actions/checkout@v2
17
+ - name : Format Unix
18
+ if : runner.os == 'Linux'
19
+ run : test -z $(go fmt ./...)
20
+ - name : Test
21
+ run : go test -covermode atomic -coverprofile='profile.cov' ./...
22
+ - name : Send coverage
23
+ if : runner.os == 'Linux'
24
+ env :
25
+ COVERALLS_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26
+ run : |
27
+ GO111MODULE=off go get github.com/mattn/goveralls
28
+ $(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
29
+ release :
30
+ runs-on : ubuntu-latest
31
+ needs : test
32
+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
33
+ steps :
34
+ - name : Checkout
35
+ uses : actions/checkout@v2
36
+ with :
37
+ fetch-depth : 0
38
+ - name : Set up Go
39
+ uses : actions/setup-go@v2
40
+ with :
41
+ go-version : 1.17
42
+ - name : install cosign
43
+ uses : sigstore/cosign-installer@main
44
+ with :
45
+ cosign-release : ' v1.2.1'
46
+ - name : Run GoReleaser
47
+ uses : goreleaser/goreleaser-action@v2
48
+ with :
49
+ distribution : goreleaser
50
+ version : latest
51
+ args : release --rm-dist
52
+ env :
53
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
54
+ COSIGN_PWD : ${{ secrets.COSIGN_PWD }}
0 commit comments