Skip to content

Commit

Permalink
makefile+scripts: add Go version check to release command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ffranr authored and guggero committed Oct 23, 2024
1 parent b10c1cb commit b63b165
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ release: app-build go-release

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

docker-release: app-build
@$(call print, "Building release helper docker image.")
Expand Down
10 changes: 10 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,21 @@ function red() {

# build_release builds the actual release binaries.
# arguments: <version-tag> <build-system(s)> <build-tags> <ldflags>
# <go-version>
function build_release() {
local tag=$1
local sys=$2
local buildtags=$3
local ldflags=$4
local goversion=$5

# Check if the active Go version matches the specified Go version.
active_go_version=$(go version | awk '{print $3}' | sed 's/go//')
if [ "$active_go_version" != "$goversion" ]; then
echo "Error: active Go version ($active_go_version) does not match \
required Go version ($goversion)."
exit 1
fi

green " - Packaging vendor"
go mod vendor
Expand Down

0 comments on commit b63b165

Please sign in to comment.