Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile+scripts: specify Go version for building release binaries #1051

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ release-install:
release:
@$(call print, "Releasing tapd and tapcli binaries.")
$(VERSION_CHECK)
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"

release-tag:
@$(call print, "Adding release tag.")
Expand Down
12 changes: 12 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,23 @@ function check_tag_correct() {

# 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

echo "Building release for tag $tag with Go version $goversion"

green " - Packaging vendor"
go mod vendor
Expand Down
Loading