#!/bin/sh # # Runs during git flow release start # # Positional arguments: # $1 Version # # Return VERSION - When VERSION is returned empty gitflow # will stop as the version is necessary # VERSION=$1 # Implement your script here. TAGS=`git tag ${VERSION}* -l|wc -l` if [ "$TAGS" != 0 ]; then LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1)) MAJOR=`echo ${LASTTAG} | sed "s/^\([0-9]*\).*/\1/")` MINOR=`echo ${LASTTAG} | sed "s/[0-9]*\.\([0-9]*\).*/\1/")` REVISION=`git rev-list $MAJOR.$MINOR --count` VERSION=$MAJOR.$MINOR.$REVISION fi # Return the VERSION echo ${VERSION} exit 0