-
Notifications
You must be signed in to change notification settings - Fork 0
/
interim-release.sh
53 lines (39 loc) · 1.12 KB
/
interim-release.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
VERSION_BASE=$1
REMOTE=$2
if [ -z "$VERSION_BASE" -o -z "$REMOTE" ]; then
echo "usage: $(basename $0) [base version] [remote]"
echo " eg: $(basename $0) 1.13.0 origin"
exit 1
fi
DATE=`date +'%Y%m%d-%H%M'`
VERSION="$VERSION_BASE.$DATE"
BRANCH="interim/$VERSION"
TAG="interim/tag-$VERSION"
CURR_BRANCH=`git rev-parse --abbrev-ref HEAD`
echo "checking out new branch $BRANCH"
git checkout -b "$BRANCH"
echo "updating version in all pom.xml files..."
pushd dom >/dev/null
mvn versions:set -DnewVersion=$VERSION > /dev/null
popd >/dev/null
echo "Committing changes"
git commit -am "bumping to $VERSION"
echo "Building"
mvn clean install -o
echo "tagging"
git tag $TAG
echo "pushing tag"
git push $REMOTE $TAG
echo "removing any earlier remote branches"
for a in `git ls-remote --heads $REMOTE | sed 's?.*refs/heads/??' | grep interim`
do
git push $REMOTE --delete $a
done
# need to push branch, so will be picked up for building by CI
echo "pushing branch"
git push $REMOTE $BRANCH
echo "switching back to original branch"
git checkout $CURR_BRANCH
echo "and deleting interim branch"
git branch -D $BRANCH