Skip to content

Commit be597cf

Browse files
committed
Use arnested/go-version-action
1 parent d15dd63 commit be597cf

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,35 @@ on:
22
- push
33
name: Build and test
44
jobs:
5+
go-version:
6+
name: Lookup go versions
7+
runs-on: ubuntu-latest
8+
outputs:
9+
minimal: ${{ steps.go-version.outputs.minimal }}
10+
matrix: ${{ steps.go-version.outputs.matrix }}
11+
steps:
12+
- uses: actions/[email protected]
13+
- uses: arnested/go-version-action@main
14+
id: go-version
515
go_generate:
616
name: Check generated code is up to date
717
if: '!github.event.deleted'
18+
needs: go-version
819
runs-on: ubuntu-latest
920
env:
1021
workdir: go/src/${{ github.repository }}
1122
steps:
1223
- uses: actions/[email protected]
1324
with:
1425
path: ${{env.workdir}}
15-
- name: Install Go
26+
- uses: arnested/go-version-action@main
27+
with:
28+
working-directory: ${{env.workdir}}
29+
id: foo
30+
- name: Install Go ${{ needs.go-version.outputs.minimal }}
1631
uses: actions/setup-go@v2
1732
with:
18-
go-version: '1.15'
33+
go-version: ${{ needs.go-version.outputs.minimal }}
1934
- name: go generate
2035
env:
2136
GO111MODULE: 'on'
@@ -28,13 +43,14 @@ jobs:
2843
build_and_test:
2944
name: Build and test
3045
if: '!github.event.deleted'
46+
needs: go-version
3147
runs-on: macos-latest
3248
strategy:
3349
matrix:
34-
go-version: ['1.15']
50+
go-version: ${{ fromJSON(needs.go-version.outputs.matrix) }}
3551
steps:
3652
- uses: actions/[email protected]
37-
- name: Install Go
53+
- name: Install Go ${{ matrix.go-version }}
3854
uses: actions/setup-go@v2
3955
with:
4056
go-version: ${{ matrix.go-version }}
@@ -48,17 +64,18 @@ jobs:
4864
uses: codecov/[email protected]
4965
with:
5066
flags: go${{ matrix.go-version }}
51-
token: ${{secrets.CODECOV_TOKEN}}
67+
token: ${{ secrets.CODECOV_TOKEN }}
5268
license_check:
5369
name: License check
70+
needs: go-version
5471
if: '!github.event.deleted'
5572
runs-on: ubuntu-latest
5673
steps:
5774
- uses: actions/[email protected]
58-
- name: Install Go
75+
- name: Install Go ${{ needs.go-version.outputs.minimal }}
5976
uses: actions/setup-go@v2
6077
with:
61-
go-version: '1.15'
78+
go-version: ${{ needs.go-version.outputs.minimal }}
6279
- name: Install wwhrd
6380
env:
6481
GO111MODULE: 'off'

.github/workflows/lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,15 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/[email protected]
26+
- uses: arnested/go-version-action@main
27+
id: go-version
28+
- name: Install Go ${{ steps.go-version.outputs.minimal }}
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: ${{ steps.go-version.outputs.minimal }}
2632
- name: golangci-lint
2733
uses: golangci/[email protected]
2834
with:
2935
version: latest
3036
only-new-issues: true
37+
skip-go-installation: true

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
- uses: actions/checkout@v2
1111
with:
1212
fetch-depth: 0
13+
- uses: arnested/go-version-action@main
14+
id: go-version
1315
- name: Bump version and push tag
1416
uses: anothrNick/[email protected]
1517
id: version
@@ -18,10 +20,10 @@ jobs:
1820
WITH_V: true
1921
DEFAULT_BUMP: patch
2022
RELEASE_BRANCHES: main
21-
- name: Set up Go
23+
- name: Set up Go ${{ steps.go-version.outputs.latest }}
2224
uses: actions/setup-go@v2
2325
with:
24-
go-version: 1.15
26+
go-version: ${{ steps.go-version.outputs.latest }}
2527
- name: Run GoReleaser
2628
uses: goreleaser/goreleaser-action@v2
2729
with:

0 commit comments

Comments
 (0)