-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (36 loc) · 1.12 KB
/
ci.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
name: Continuous Integration
on:
pull_request:
push:
jobs:
build:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20.1'
- name: Check out
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod download
- name: Test Build
run: |
export LDFLAGS="-X main.version=TEST${GITHUB_REF_NAME}TEST -X main.revision=TEST${GITHUB_SHA}TEST -X main.built=`date -u +%Y-%m-%dT%H:%M:%SZ`"
go build -ldflags "$LDFLAGS" -o dist/watch-linux-amd64 .
dist/watch-linux-amd64 --version | grep " Version: TEST${GITHUB_REF_NAME}TEST"
dist/watch-linux-amd64 --version | grep " Revision: TEST${GITHUB_SHA}TEST"
- name: Tests
run: |
go test -v ./...
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}