Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1730 from helium/jg/guard_val_untagged_releases
Browse files Browse the repository at this point in the history
prevent tagging validator release without updating version in miner.erl
  • Loading branch information
Vagabond authored Jul 14, 2022
2 parents 065f297 + e2206e3 commit 1091a66
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tag-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ dep_hash() {
git show "${MINER}:rebar.lock" | grep -A2 "${DEP}" | sed -e "s/.*\"\(.*\)\".*/\1/" | tr '\n' ' ' | awk '{print $3}'
}

val_tag() {
local VAL_VERSION
local MAJ
local MIN
local PATCH

VAL_VERSION=$(sed -n "/^version() ->$/,/\.$/p" src/miner.erl | grep -o -E '[0-9]{10}')
MAJ=$(echo $VAL_VERSION | awk '{print substr( $0, 1, 3 )}')
MIN=$(echo $VAL_VERSION | awk '{print substr( $0, 4, 3 )}')
PATCH=$(echo $VAL_VERSION | awk '{print substr( $0, 7, 4 )}')

echo "validator$((10#$MAJ)).$((10#$MIN)).$((10#$PATCH))"
}

declare -r repos="blockchain libp2p sibyl ecc508 relcast dkg hbbft helium_proto"
declare NAMED_TAG

Expand Down Expand Up @@ -44,6 +58,11 @@ fi
MINER_HASH=$1

if [[ ! -z $NAMED_TAG ]]; then
VAL_VERSION_TO_TAG=$(val_tag)
if [[ ! $VAL_VERSION_TO_TAG == $NAMED_TAG ]]; then
echo "tag doesnt match committed version; should be ${VAL_VERSION_TO_TAG} per miner.erl!"
exit 1
fi
RELEASE_TAG=$NAMED_TAG
else
while git tag -l | grep -q "${TAG_NAME}.${TAG_NUMBER}"; do
Expand Down

0 comments on commit 1091a66

Please sign in to comment.