Merge "add license scan to stage_2"
[osm/devops.git] / tools / newtag.sh
1 #!/bin/bash
2 if [ $# -ne 2 ]; then
3 echo "Usage $0 <repo> <tag>"
4 exit 1
5 fi
6
7 CURRENT_BRANCH="v2.0"
8 TAG="$2"
9 tag_header="OSM Release TWO:"
10 tag_message="$tag_header version $TAG"
11
12 modules="juju-charms devops descriptor-packages openvim RO SO UI osmclient"
13 list=""
14 for i in $modules; do
15 if [ "$1" == "$i" -o "$1" == "all" ]; then
16 list="$1"
17 break
18 fi
19 done
20
21 [ "$1" == "all" ] && list=$modules
22
23 if [ -z "$list" ]; then
24 echo "Repo must be one of these: $modules all"
25 exit 1
26 fi
27
28 for i in $list; do
29 echo
30 echo $i
31 if [ "$i" == "juju-charms" ] && [ "$1" == "all" ] ; then
32 #This is to allow "./newtag.sh all v2.0.0", and still checkout master in "juju-charms" before tagging
33 git -C $i checkout master
34 else
35 git -C $i checkout $CURRENT_BRANCH
36 fi
37 git -C $i pull --rebase
38 git -C $i tag -a $TAG -m"$tag_message"
39 git -C $i push origin $TAG --follow-tags
40 sleep 2
41 done
42
43 exit 0
44