Skip to content

Commit

Permalink
chore: Use Dockerfile as source for the Go version
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Jan 15, 2024
1 parent a1d5473 commit 0bc79b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .github/actions/setup-goversion/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: setup-goversion
runs:
using: composite
steps:
- id: goversion
run: |
cat Dockerfile | awk '/^FROM golang:.* as build$/ {v=$2;split(v,a,":")}; END {printf("version=%s", a[2])}' >> $GITHUB_OUTPUT
shell: bash
- uses: actions/setup-go@v5
with:
go-version: "${{steps.goversion.outputs.version}}"
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-tags: true
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: ./.github/actions/setup-goversion
- run: make cross
- id: docker_tag
run: echo "DOCKER_TAG=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: ./.github/actions/setup-goversion
- run: make lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: ./.github/actions/setup-goversion
- uses: azure/setup-helm@v3
with:
version: '3.13.1'
Expand All @@ -36,7 +32,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: ./.github/actions/setup-goversion
- run: make cross

0 comments on commit 0bc79b8

Please sign in to comment.