Skip to content

Commit 3ef705d

Browse files
committed
chore: Define golang version in a single file
1 parent 113269c commit 3ef705d

File tree

5 files changed

+17
-20
lines changed

5 files changed

+17
-20
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ env:
2020
E2E_SETUP_KIND: yes
2121
E2E_SETUP_KUBECTL: yes
2222
SUDO: sudo
23-
GO_VERSION: "1.25.6"
2423
GOLANGCI_LINT_VERSION: "v2.8.0"
2524

2625
jobs:
@@ -34,7 +33,7 @@ jobs:
3433
- name: Set up Go 1.x
3534
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
3635
with:
37-
go-version: ${{ env.GO_VERSION }}
36+
go-version-file: '.go-version'
3837
id: go
3938

4039
- name: Lint
@@ -52,7 +51,7 @@ jobs:
5251
- name: Set up Go 1.x
5352
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
5453
with:
55-
go-version: ${{ env.GO_VERSION }}
54+
go-version-file: '.go-version'
5655
id: go
5756

5857
- name: Validate generated manifests
@@ -69,7 +68,7 @@ jobs:
6968
- name: Set up Go 1.x
7069
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
7170
with:
72-
go-version: ${{ env.GO_VERSION }}
71+
go-version-file: '.go-version'
7372
id: go
7473

7574
- name: Validate go modules
@@ -86,7 +85,7 @@ jobs:
8685
- name: Set up Go 1.x
8786
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
8887
with:
89-
go-version: ${{ env.GO_VERSION }}
88+
go-version-file: '.go-version'
9089
id: go
9190

9291
- name: Check that all metrics are documented and templates have no delta
@@ -103,7 +102,7 @@ jobs:
103102
- name: Set up Go 1.x
104103
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
105104
with:
106-
go-version: ${{ env.GO_VERSION }}
105+
go-version-file: '.go-version'
107106
id: go
108107

109108
- name: Unit tests
@@ -135,7 +134,7 @@ jobs:
135134
- name: Set up Go 1.x
136135
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
137136
with:
138-
go-version: ${{ env.GO_VERSION }}
137+
go-version-file: '.go-version'
139138
id: go
140139

141140
- name: Benchmark tests
@@ -163,7 +162,7 @@ jobs:
163162
- name: Set up Go 1.x
164163
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
165164
with:
166-
go-version: ${{ env.GO_VERSION }}
165+
go-version-file: '.go-version'
167166
id: go
168167

169168
- name: Benchmark tests
@@ -191,7 +190,7 @@ jobs:
191190
- name: Set up Go 1.x
192191
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
193192
with:
194-
go-version: ${{ env.GO_VERSION }}
193+
go-version-file: '.go-version'
195194
id: go
196195

197196
- name: Build
@@ -208,7 +207,7 @@ jobs:
208207
- name: Set up Go 1.x
209208
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
210209
with:
211-
go-version: ${{ env.GO_VERSION }}
210+
go-version-file: '.go-version'
212211
id: go
213212

214213
- name: End-to-end tests

.github/workflows/govulncheck.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
# Run every Monday
66
- cron: '0 0 * * 1'
77

8-
env:
9-
GO_VERSION: "^1.24"
10-
118
permissions:
129
contents: read
1310

@@ -20,7 +17,7 @@ jobs:
2017
- name: Set up Go 1.x
2118
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
2219
with:
23-
go-version: ${{ env.GO_VERSION }}
20+
go-version-file: '.go-version'
2421
- name: Install govulncheck binary
2522
run: |
2623
go install golang.org/x/vuln/cmd/govulncheck@latest

.github/workflows/pre-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout (full history)
17-
uses: actions/checkout@v6
17+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1818
with:
1919
fetch-depth: 0
2020
- name: Extract versions
2121
id: versions
2222
run: |
2323
# Extract Go version from Dockerfile
24-
GO_VERSION=$(grep '^ARG GOVERSION=' Dockerfile | cut -d'=' -f2)
24+
GO_VERSION=$(cat .go-version)
2525
echo "go-version=${GO_VERSION}" >> $GITHUB_OUTPUT
2626
2727
# Extract k8s.io/client-go version from go.mod
@@ -31,12 +31,12 @@ jobs:
3131
echo "📦 Go version: ${GO_VERSION}"
3232
echo "📦 k8s.io/client-go version: ${CLIENT_GO_VERSION}"
3333
- name: Set up Go
34-
uses: actions/setup-go@v6
34+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
3535
with:
36-
go-version: ${{ steps.versions.outputs.go-version }}
36+
go-version-file: '.go-version'
3737
id: go
3838
- name: Make pre-release
39-
uses: goreleaser/goreleaser-action@v6
39+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
4040
with:
4141
version: latest
4242
args: release --clean

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.25.6

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ OS ?= $(shell uname -s | tr A-Z a-z)
1414
ALL_ARCH = amd64 arm arm64 ppc64le s390x
1515
PKG = github.com/prometheus/common
1616
PROMETHEUS_VERSION = 3.9.1
17-
GO_VERSION = 1.25.5
17+
GO_VERSION = $(shell cat .go-version)
1818
IMAGE = $(REGISTRY)/kube-state-metrics
1919
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
2020
USER ?= $(shell id -u -n)

0 commit comments

Comments
 (0)