/
publish_release.sh
executable file
·82 lines (64 loc) · 1.87 KB
/
publish_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# error out if any statements fail
set -e
set -x
function usage() {
echo "$0 [options] <tag> <branch> <user> <email>"
echo
echo " tag : Release tag (eg: 2.1.4, 2.2-beta1, ...)"
echo " user: Git username"
echo " email: Git email"
echo
}
if [ -z $4 ]; then
usage
exit
fi
tag=$1
branch=$2
git_user=$3
git_email=$4
# load properties + functions
. "$( cd "$( dirname "$0" )" && pwd )"/properties
. "$( cd "$( dirname "$0" )" && pwd )"/functions
if [ `is_version_num $tag` == "0" ]; then
echo "$tag is a not a valid release tag"
exit 1
fi
if [ `is_primary_branch_num $tag` == "1" ]; then
echo "$tag is a not a valid release tag, can't be same as primary branch name"
exit 1
fi
pushd ../../ > /dev/null
init_git $git_user $git_email
# switch to the release branch
git checkout rel_$tag
# ensure no changes on it
set +e
git status | grep "working directory clean"
if [ "$?" == "1" ]; then
echo "branch rel_$tag dirty, exiting"
exit 1
fi
set -e
# deploy the release to maven repo
mvn deploy -DskipTests -Dall
mvn -P deploy.opengeo deploy -DskipTests -Dall
# get <major.minor> for sf release dir
if [ "$( echo $str | egrep "[0-9]+\.[0-9]+((\.|-).*)?" )" != "$str" ]; then
echo "$tag is not a valid release version number"
exit 1
fi
dir=`echo $tag | sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/g'`
pushd $DIST_PATH/$tag > /dev/null
#JD: disabling this for now... i think something recently changes on the sf
# server in that we can't use ssh directly to log in, need to find an
# to this command for remotely creating a directory on the server
#ssh -i $SF_PK $SF_USER@$SF_HOST mkdir -p "/home/pfs/project/g/ge/geotools/GeoTools\ $dir\ Releases"
rsync -ave "ssh -i $SF_PK" *.zip $SF_USER@$SF_HOST:"/home/pfs/project/g/ge/geotools/GeoTools\ $dir\ Releases/$tag/"
popd > /dev/null
# tag the release branch
git tag $tag
# push up tag
git push origin $tag
popd > /dev/null