#! /bin/bash # Return the version string used to describe this version of Metabase. TAG=$(git describe origin/master --tags --abbrev=0) HASH=$(git show-ref --head --hash=7 head) # first 7 letters of hash should be enough; that's what GitHub uses BRANCH=$(git symbolic-ref --short HEAD) # ./version -> v0.11.1 (346cbe2 master) # ./version --short -> v0.11.1 if [ "$1" == "--short" ]; then echo "$TAG" else echo "$TAG ($HASH $BRANCH)" fi