Skip to content

Commit

Permalink
.github: use go.mod to infer version for setup-go.
Browse files Browse the repository at this point in the history
Including publishing docs, which now also uses setup-go instead
of manually installing the golang toolchain from a tarball.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and askervin committed Dec 17, 2024
1 parent 109d59c commit b84c451
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- main
- "release-*"

env:
GO_VERSION: "1.22.1"

jobs:
golangci-lint:
name: golangci-lint
Expand All @@ -23,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v6
with:
version: v1.61
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
tags:
- v[0-9]+.[0-9]+.[0-9]+

env:
GO_VERSION: "1.22.1"

concurrency:
group: gh-pages

Expand All @@ -21,15 +18,9 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install exact golang version from release tarball if needed
run: |
go_version=$(go version | sed 's/^go version //;s/ .*$//')
if [ "$go_version" != "${{ env.GO_VERSION }} " ]; then
wget https://go.dev/dl/go${{ env.GO_VERSION }}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-amd64.tar.gz
echo "/usr/local/go/bin" >> $GITHUB_PATH
fi
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install build dependencies
run: |
pip3 install --user -r docs/requirements.txt
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- main
- "release-*"

env:
GO_VERSION: "1.22.1"

jobs:
verify-deps:
name: Dependencies
Expand All @@ -23,7 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- run: |
make verify-godeps
Expand All @@ -37,7 +34,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- run: |
if ! git diff-index --check origin/${{ github.base_ref }} --; then
echo "This PR would introduce the errors shown above."
Expand All @@ -56,7 +53,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- run: |
make verify-generate
Expand All @@ -70,7 +67,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- run: |
make verify-build
Expand All @@ -84,7 +81,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: go.mod
- run: |
pip3 install --user -r docs/requirements.txt
echo "`python3 -m site --user-base`/bin" >> $GITHUB_PATH
Expand Down

0 comments on commit b84c451

Please sign in to comment.