clone repo if repo doesn't already exist
[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 TAG="$2"
8 tag_header="OSM Release THREE:" tag_message="$tag_header version $TAG"
9
10 modules="devops openvim RO SO UI IM osmclient"
11 list=""
12 for i in $modules; do
13 if [ "$1" == "$i" -o "$1" == "all" ]; then
14 list="$1"
15 break
16 fi
17 done
18
19 [ "$1" == "all" ] && list=$modules
20
21 if [ -z "$list" ]; then
22 echo "Repo must be one of these: $modules all"
23 exit 1
24 fi
25
26 for i in $list; do
27 echo
28 echo $i
29 if [ ! -d $i ]; then
30 git clone https://osm.etsi.org/gerrit/osm/$i
31 fi
32 git -C $i checkout master
33 git -C $i pull --rebase
34 git -C $i tag -a $TAG -m"$tag_message"
35 git -C $i push origin $TAG --follow-tags
36 sleep 2
37 done
38
39 exit 0