-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (82 loc) · 1.95 KB
/
pipelines.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#on: pull_request
on:
push:
branches:
- '**'
tags:
- 'v*'
#tag-ignore:
# - 'v*'
workflow_dispatch: {}
name: ReAcT
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
#go-version: 'stable'
go-version-file: 'go.mod'
check-latest: true
id: go
- name: Lint
run: |
go mod tidy
make fmt
make vet
#go get -u golang.org/x/lint/golint
#make lint
if: success()
- name: Test
run: make test
if: success()
- name: Build
run: go build -mod vendor ./...
if: success()
release:
if: startsWith(github.ref, 'refs/tags/v')
name: Release
runs-on: ubuntu-latest
needs: [ test ]
steps:
# - name: Check out code
# uses: actions/checkout@master
# - name: goreleaser
# uses: docker://goreleaser/goreleaser
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# args: release
# if: success()
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # disable shallow clone - get all
#- name: Unshallow
# run: git fetch --prune --unshallow
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: true
id: go
- name: Generate build tag
run: |
VERSION=$(git describe --tags --always --dirty --match=v* 2> /dev/null || echo v0)
echo "VERSION=$VERSION" >> $GITHUB_ENV
shell: /bin/bash -e {0}
- name: Print build tag
run: echo "${VERSION}"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
workdir: .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}