Skip to content

Commit

Permalink
build(goreleaser): do not use mainnet to determine brew keg type
Browse files Browse the repository at this point in the history
fixes #1191

Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Jun 17, 2021
1 parent ae06d8d commit d0cbd69
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ GIT_HEAD_COMMIT_LONG := $(shell git log -1 --format='%H')
GIT_HEAD_COMMIT_SHORT := $(shell git rev-parse --short HEAD)
GIT_HEAD_ABBREV := $(shell git rev-parse --abbrev-ref HEAD)

GORELEASER_TAG ?= $(shell git describe --tags --abbrev=0)
GORELEASER_IS_PREREL ?= $(shell $(ROOT_DIR)/script/is_prerelease.sh "$(GORELEASER_TAG)")

# BUILD_TAGS are for builds withing this makefile
# GORELEASER_BUILD_TAGS are for goreleaser only
# Setting mainnet flag based on env value
Expand All @@ -34,17 +37,20 @@ ifeq ($(MAINNET),true)
BUILD_MAINNET=mainnet
BUILD_TAGS=osusergo,netgo,ledger,mainnet,static_build
GORELEASER_BUILD_TAGS=$(BUILD_TAGS)
GORELEASER_HOMEBREW_NAME=akash
GORELEASER_HOMEBREW_CUSTOM=
else
BUILD_TAGS=osusergo,netgo,ledger,static_build
GORELEASER_BUILD_TAGS=$(BUILD_TAGS),testnet

endif

ifeq ($(GORELEASER_IS_PREREL),false)
GORELEASER_HOMEBREW_NAME=akash
GORELEASER_HOMEBREW_CUSTOM=
else
GORELEASER_HOMEBREW_NAME="akash-edge"
GORELEASER_HOMEBREW_CUSTOM=keg_only :unneeded, \"This is testnet release. Run brew install ovrclk/tap/akash to install mainnet version\"
endif

GORELEASER_TAG ?= $(shell git describe --tags --abbrev=0)

GORELEASER_FLAGS = -tags="$(GORELEASER_BUILD_TAGS)"
GORELEASER_LD_FLAGS = -s -w -X github.com/cosmos/cosmos-sdk/version.Name=akash \
-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
Expand Down
12 changes: 12 additions & 0 deletions script/is_prerelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# in akash even minor part of the tag indicates release belongs to the MAINNET
# using it as scripts simplifies debugging as well as portability
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

if [[ $# -ne 1 ]]; then
echo "illegal number of parameters"
exit 1
fi

[[ -n $("${SCRIPT_DIR}"/semver.sh get prerel "$1") ]] && echo true || echo false

0 comments on commit d0cbd69

Please sign in to comment.