#!/bin/sh

# Is this a release - build from tag?
if git describe --tags --match "v[0-9]*" | grep -q '-'; then
    # This is a master build, we want to make every build
    # newer than all the previous builds using a timestamp,
    # and make it easy to locate the commit from the build
    # with the git commit hash.
    release="0.$(date -u +%Y%m%d%H%M)"
    commithash=$(git rev-parse --short HEAD)
    release+=.git$commithash
else
    # We want to make tagged build newer than any other build from same
    # version-release.
    release="1"
fi

echo $release
