forked from geoserver/geoserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish_release.sh
executable file
·108 lines (85 loc) · 2.74 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
104
105
106
#!/bin/bash
# error out if any statements fail
set -e
function usage() {
echo "$0 [options] <tag> <branch>"
echo
echo " tag : Release tag (eg: 2.1.4, 2.2-beta1, ...)"
echo " branch: Release branch (eg, 2.1.x, 2.2.x)"
echo
echo "Environment variables:"
echo " MAVEN_SETTINGS : settings.xml override"
echo " SKIP_DEPLOY : Skips deploy to maven repository"
echo " SKIP_UPLOAD : Skips upload to source forge"
}
if [ -z $2 ]; then
usage
exit
fi
tag=$1
branch=$2
# 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
# fetch single tag
git fetch origin refs/tags/$tag:refs/tags/$tag --no-tags
# ensure tag already exists
if [ `git tag --list $tag | wc -l` == 0 ]; then
echo "tag $tag not available on $GS_GIT_URL"
exit 1
fi
# check to see if a release branch already exists
if [ `git branch --list rel_$tag | wc -l` == 1 ]; then
echo "branch rel_$tag exists, deleting it"
git branch -D rel_$tag
fi
# create release branch from tag
git checkout -b rel_$tag $tag
# ensure no changes on it (actually release folder is a change)
# 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 $MAVEN_FLAGS
deploy released community modules
pushd community > /dev/null
set +e
mvn clean install deploy -P communityRelease -DskipTests $MAVEN_FLAGS
set -e
popd > /dev/null
else
echo "Skipping mvn clean install deploy -P allExtensions -DskipTests"
fi
popd > /dev/null
# upload artifacts to sourceforge
pushd distribution/$tag > /dev/null
if [ -z $SKIP_UPLOAD ]; then
rsync -ave "ssh " *-bin.zip *-war.zip *doc.zip $SF_USER@$SF_HOST:/home/pfs/project/g/ge/geoserver/GeoServer/$tag/
# don't fail if exe or pdf is not around
set +e
rsync -ave "ssh " *.exe *.pdf $SF_USER@$SF_HOST:/home/pfs/project/g/ge/geoserver/GeoServer/$tag/
set -e
pushd plugins > /dev/null
rsync -ave "ssh " *.zip $SF_USER@$SF_HOST:"/home/pfs/project/g/ge/geoserver/GeoServer/$tag/extensions"
popd > /dev/null
else
echo "Skipping rsync -ave "ssh " *.zip *.exe $SF_USER@$SF_HOST:/home/pfs/project/g/ge/geoserver/GeoServer/$tag/"
echo "Skipping rsync -ave "ssh " *.zip $SF_USER@$SF_HOST:"/home/pfs/project/g/ge/geoserver/GeoServer/$tag/extensions""
fi
popd > /dev/null