summaryrefslogtreecommitdiff
path: root/ci/update_version.sh
blob: ea1d70d716d020c7f480c33c276880e4d91168bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
if [ -z "$CIRCLE_BUILD_NUM" -o "$CIRCLE_PROJECT_USERNAME" != "navit-gps" ] ; then
  exit
fi

if ! git log -n 1 --oneline ; then
  echo "This script should be run from the versioned directory"
  exit 1
fi

if [ "$CIRCLE_BRANCH" != "trunk" ] ; then
  exit
fi

TAG=R$(( 5658 + $CIRCLE_BUILD_NUM ))

if [ "$1" == "prepare" ] ; then
  git log -1 --format="%H %d" | grep 'tag: R' 
  if [ $? -eq 0 ] ; then
    echo "This commit is already tagged."
    exit
  fi
  git tag $TAG
  exit
fi

if [ "$1" == "push" ] ; then
  git log -1 --format="%H %d" | grep "tag: $TAG"
  if [ $? -eq 0 ] ; then
    echo Pushing tag $TAG to origin...
    git push origin $TAG
  fi
fi