forked from geoserver/geoserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_release.sh
executable file
·104 lines (85 loc) · 2.46 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# error out if any statements fail
set -e
function usage() {
echo "$0 [options] <tag> <branch> <user> <email>"
echo
echo " tag : Release tag (eg: 2.1.4, 2.2-beta1, ...)"
echo " branch: Release branch (eg, 2.1.x, 2.2.x)"
echo " user: Git username"
echo " email: Git email"
echo
echo "Environment variables:"
echo " SKIP_DEPLOY : Skips deploy to maven repository"
echo " SKIP_MERGE_AND_TAG : Skips merge/tag of release branch"
echo " SKIP_PUSH : Skips pushing changes to release branch and tag"
}
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
pushd src > /dev/null
if [ -z $SKIP_DEPLOY ]; then
mvn deploy -P allExtensions -DskipTests
# deploy released community modules
pushd community > /dev/null
set +e
mvn deploy -P communityRelease -DskipTests
set -e
popd > /dev/null
else
echo "Skipping mvn deploy -P allExtensions -DskipTests"
fi
popd > /dev/null
# upload artifacts to sourceforge
pushd $DIST_PATH/$tag > /dev/null
if [ -z $SKIP_DEPLOY ]; then
rsync -ave "ssh -i $SF_PK" *.zip *.exe *.dmg $SF_USER@$SF_HOST:/home/pfs/project/g/ge/geoserver/GeoServer/$tag/
pushd plugins > /dev/null
rsync -ave "ssh -i $SF_PK" *.zip $SF_USER@$SF_HOST:"/home/pfs/project/g/ge/geoserver/GeoServer\ Extensions/$tag/"
popd > /dev/null
else
echo "Skipping rsync -ave "ssh -i $SF_PK" *.zip *.exe *.dmg $SF_USER@$SF_HOST:/home/pfs/project/g/ge/geoserver/GeoServer/$tag/"
echo "Skipping rsync -ave "ssh -i $SF_PK" *.zip $SF_USER@$SF_HOST:"/home/pfs/project/g/ge/geoserver/GeoServer\ Extensions/$tag/""
fi
popd > /dev/null
# tag release branch
if [ -z $SKIP_MERGE_AND_TAG ]; then
git tag $tag
else
echo "Skipping git tag $tag"
fi
# push tag up
if [ -z $SKIP_PUSH ]; then
git push origin $tag
else
echo "Skipping git push origin $tag"
fi