taler-mailbox

Service for asynchronous wallet-to-wallet payment messages
Log | Files | Refs | Submodules | README | LICENSE

version.sh (756B)


      1 #!/bin/sh
      2 set -ex
      3 # This file is in the public domain.
      4 # Determines the current version of our code.
      5 # Shared between various jobs.
      6 
      7 BRANCH=$(git name-rev --name-only HEAD)
      8 if [ -z "${BRANCH}" ]; then
      9 	exit 1
     10 else
     11         # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
     12 	git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
     13 	RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1)
     14 	commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
     15 	if [ "${commits}" = "0" ]; then
     16 		git describe --tag HEAD | sed -r 's/^v//' || exit 1
     17 	else
     18 		echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
     19 	fi
     20 fi