aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/go-release-build.yml
blob: bc99dad36a9f40fdd9f06da92e6d638f712106c0 (plain) (blame)
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:
    branches:
      - 'master'
    tags:
      - 'v*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.15

      -
        name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      -
        name: Tests
        run: |
          export GOPATH=/home/runner/go
          mkdir -p $GOPATH/src/github.com/$GITHUB_ACTOR
          mv $GITHUB_WORKSPACE $GOPATH/src/github.com/$GITHUB_ACTOR
          ln -s $GOPATH/src/github.com/$GITHUB_REPOSITORY $GITHUB_WORKSPACE
          # go mod tidy
          go get -v ./...
          go test -v ./...

      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2
        if: success() && startsWith(github.ref, 'refs/tags/')
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}