diff --git a/tag-release.sh b/tag-release.sh index fa57f8779..b4f91764a 100755 --- a/tag-release.sh +++ b/tag-release.sh @@ -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 @@ -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