Skip to content

Commit

Permalink
build: fix deprecated notices for goreleaser skip flags (#1911)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian authored Jan 8, 2024
1 parent 06dc088 commit 5849c2f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
27 changes: 16 additions & 11 deletions make/releasing.mk
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
GON_CONFIGFILE ?= gon.json

GORELEASER_SKIP_VALIDATE ?= false
GORELEASER_DEBUG ?= false
GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:$(GOTOOLCHAIN_SEMVER)
GORELEASER_RELEASE ?= false
GORELEASER_MOUNT_CONFIG ?= false

RELEASE_DOCKER_IMAGE ?= ghcr.io/akash-network/node

ifeq ($(GORELEASER_RELEASE),true)
GORELEASER_SKIP_VALIDATE := false
GORELEASER_SKIP_PUBLISH := release --skip-publish=false
else
GORELEASER_SKIP_PUBLISH := --skip-publish=true
GORELEASER_SKIP_VALIDATE ?= false
GORELEASER_SKIP_FLAGS := $(GORELEASER_SKIP)
GORELEASER_SKIP :=

null :=
space := $(null) #
comma := ,

ifneq ($(GORELEASER_RELEASE),true)
GITHUB_TOKEN=
GORELEASER_SKIP_FLAGS += publish
endif

ifneq ($(GORELEASER_SKIP_FLAGS),)
GORELEASER_SKIP := --skip=$(subst $(space),$(comma),$(strip $(GORELEASER_SKIP_FLAGS)))
endif

ifeq ($(GORELEASER_MOUNT_CONFIG),true)
Expand Down Expand Up @@ -68,8 +74,7 @@ docker-image:
-f .goreleaser-docker.yaml \
--debug=$(GORELEASER_DEBUG) \
--clean \
--skip-validate \
--skip-publish \
--skip=publish,validate \
--snapshot

.PHONY: gen-changelog
Expand Down Expand Up @@ -97,8 +102,8 @@ release: gen-changelog
-w /go/src/$(GO_MOD_NAME) \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" \
$(GORELEASER_SKIP_PUBLISH) \
--skip-validate=$(GORELEASER_SKIP_VALIDATE) \
release \
$(GORELEASER_SKIP) \
--debug=$(GORELEASER_DEBUG) \
--clean \
--release-notes=/go/src/$(GO_MOD_NAME)/.cache/changelog.md
15 changes: 14 additions & 1 deletion script/tools.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -x

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
SEMVER=$SCRIPT_DIR/semver.sh

Expand All @@ -8,13 +10,24 @@ gomod="$SCRIPT_DIR/../go.mod"
function get_gotoolchain() {
local gotoolchain
local goversion
local local_goversion

gotoolchain=$(grep -E '^toolchain go[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$' < "$gomod" | cut -d ' ' -f 2 | tr -d '\n')
goversion=$(grep -E '^go [0-9]{1,}.[0-9]{1,}(.[0-9]{1,})?$' < "$gomod" | cut -d ' ' -f 2 | tr -d '\n')

if [[ ${gotoolchain} == "" ]]; then
# determine go toolchain from go version in go.mod
if which go > /dev/null 2>&1 ; then
goversion=$(GOTOOLCHAIN=local go version | cut -d ' ' -f 3 | sed 's/go*//' | tr -d '\n')
local_goversion=$(GOTOOLCHAIN=local go version | cut -d ' ' -f 3 | sed 's/go*//' | tr -d '\n')
if [[ $($SEMVER compare "v$local_goversion" v"$goversion") -ge 0 ]]; then
goversion=$local_goversion
else
local_goversion=
fi
fi

if [[ "$local_goversion" == "" ]]; then
goversion=$(curl -s "https://go.dev/dl/?mode=json&include=all" | jq -r --arg regexp "^go$goversion" '.[] | select(.stable == true) | select(.version | match($regexp)) | .version' | head -n 1 | sed -e s/^go//)
fi

if [[ $goversion != "" ]] && [[ $($SEMVER compare "v$goversion" v1.21.0) -ge 0 ]]; then
Expand Down

0 comments on commit 5849c2f

Please sign in to comment.