Merge pull request #17090 from machine424/bump_go

chore: add a "make bump-go-version" to handle Go bumps across all files
This commit is contained in:
Ayoub Mrini 2025-09-01 13:05:29 +02:00 committed by GitHub
parent 18626a99c4
commit 2cbeef6d95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

View File

@ -196,3 +196,8 @@ update-all-go-deps:
.PHONY: check-node-version
check-node-version:
@./scripts/check-node-version.sh
.PHONY: bump-go-version
bump-go-version:
@echo ">> bumping Go minor version"
@./scripts/bump_go_version.sh

33
scripts/bump_go_version.sh Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -u -o pipefail
# Bump Go version (minor version bump only) across the repository.
# Run from repo root.
IFS='.' read -r current_major current_minor _ <<< "$(go mod edit -json go.mod | jq -r .Go)"
new_minor=$((current_minor + 1))
# We need to support latest-1.
latest_minor=$((current_minor + 2))
CURRENT_VERSION="${current_major}.${current_minor}"
NEW_VERSION="${current_major}.${new_minor}"
LATEST_VERSION="${current_major}.${latest_minor}"
printf "Current minimum supported version: ${CURRENT_VERSION}\nNew minimum supported version: ${NEW_VERSION}\nLatest version: ${LATEST_VERSION}\n"
# Update go.mod files
go mod edit -go=${NEW_VERSION}.0
go mod edit -go=${NEW_VERSION}.0 documentation/examples/remote_storage/go.mod
# Update .promu.yml
sed -i "s/version: ${NEW_VERSION}/version: ${LATEST_VERSION}/g" .promu.yml
# Update GitHub Actions workflows
# Keep ordered so some versions aren't bumped twice
sed -i "s/go-version: ${NEW_VERSION}\.x/go-version: ${LATEST_VERSION}.x/g" scripts/golangci-lint.yml .github/workflows/*.yml
sed -i "s/golang-builder:${NEW_VERSION}-base/golang-builder:${LATEST_VERSION}-base/g" .github/workflows/*.yml
sed -i "s/go-version: ${CURRENT_VERSION}\.x/go-version: ${NEW_VERSION}.x/g" scripts/golangci-lint.yml .github/workflows/*.yml
sed -i "s/golang-builder:${CURRENT_VERSION}-base/golang-builder:${NEW_VERSION}-base/g" .github/workflows/*.yml
echo "Please review the changes and commit them."