Skip to content

Commit acf547e

Browse files
ffranrguggero
authored andcommitted
makefile+scripts: add Go version check to release command
This commit updates `scripts/release.sh` to include a check for the correct Go version before executing the release build. This ensures that the release binaries are built with the specified Go version, maintaining consistency and integrity for developer signatures.
1 parent 1338cfa commit acf547e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ release: app-build go-release
168168

169169
go-release:
170170
@$(call print, "Creating release of lightning-terminal.")
171-
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(LND_RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
171+
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(LND_RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"
172172

173173
docker-release: app-build
174174
@$(call print, "Building release helper docker image.")

scripts/release.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,21 @@ function red() {
8484

8585
# build_release builds the actual release binaries.
8686
# arguments: <version-tag> <build-system(s)> <build-tags> <ldflags>
87+
# <go-version>
8788
function build_release() {
8889
local tag=$1
8990
local sys=$2
9091
local buildtags=$3
9192
local ldflags=$4
93+
local goversion=$5
94+
95+
# Check if the active Go version matches the specified Go version.
96+
active_go_version=$(go version | awk '{print $3}' | sed 's/go//')
97+
if [ "$active_go_version" != "$goversion" ]; then
98+
echo "Error: active Go version ($active_go_version) does not match \
99+
required Go version ($goversion)."
100+
exit 1
101+
fi
92102

93103
green " - Packaging vendor"
94104
go mod vendor

0 commit comments

Comments
 (0)