forked from sevntu-checkstyle/sevntu.checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·191 lines (167 loc) · 4.76 KB
/
deploy.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/sh
EXEC_DIR=`dirname $0`
REPO_HOME_DIR=`cd "$EXEC_DIR" ; pwd`
usage="$(basename "$0") [--help --all --eclipse-cs --sonar --maven --idea]
where:
--help show this help text
--all deploy all projects;
--eclipse-cs deploy only 'sevntu-checkstyle-eclipsecs-plugin' project;
--sonar deploy only 'sevntu-checkstyle-sonar-plugin' project;
--maven deploy only 'sevntu-checkstyle-maven-plugin' project;
--idea deploy only 'sevntu-checkstyle-idea-extension' project;
"
manualDeploy="
For new version deploy please do:
cd gh-pages && git add . && git commit -m \"new version deploy\" && git push origin gh-pages
"
prepareForDeploy()
{
#clean
rm -rf $REPO_HOME_DIR/gh-pages
#prepare folders for update-site and our release maven repository
mkdir $REPO_HOME_DIR/gh-pages
cd $REPO_HOME_DIR/gh-pages
git init
git remote add origin https://github.com/sevntu-checkstyle/sevntu.checkstyle.git
git fetch origin gh-pages:refs/remotes/origin/gh-pages
git checkout gh-pages
cd $REPO_HOME_DIR
return
}
deployIdea()
{
cd $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/
mvn clean deploy
if [ "$?" != "0" ]
then
echo "build for $REPO_HOME_DIR/sevntu-checkstyle-idea-extension/"
exit 1
fi
cd $REPO_HOME_DIR/gh-pages
echo "$manualDeploy"
return
}
deployEclipse()
{
cd $REPO_HOME_DIR
#echo -n "Enter version number: "
#read version
#mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$version -f eclipse-pom.xml
mvn clean install -f eclipse-pom.xml
if [ "$?" != "0" ]
then
echo "build for eclipse-pom.xml."
exit 1
fi
cd $REPO_HOME_DIR/update-site
mvn wagon:upload
cd ../gh-pages
echo "$manualDeploy"
return
}
deployMavenLibrary()
{
# As we do not use SNAPSHOT qualifier for developemnt in pom.xml
# we have to deploy library sevntu-checks always even it overides existing binaries in maven repository
# for relase build - it will not override binaries
# for test build - it will override as we need to be sure that in repository,
# we have previous release version but compiled with from new code
cd $REPO_HOME_DIR/sevntu-checks
mvn clean deploy
if [ "$?" != "0" ]
then
echo "build for $REPO_HOME_DIR/sevntu-checks."
exit 1
fi
cd $REPO_HOME_DIR
# no need push to repository only library it should be done together with IDE plugins release
#cd ../gh-pages
#echo "$manualDeploy"
return
}
deployMavenPlugin()
{
cd $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/
mvn clean deploy
if [ "$?" != "0" ]
then
echo "build for $REPO_HOME_DIR/sevntu-checkstyle-maven-plugin/."
exit 1
fi
cd $REPO_HOME_DIR/gh-pages
echo "$manualDeploy"
return
}
deploySonar()
{
cd $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/
mvn clean install wagon:upload-single
if [ "$?" != "0" ]
then
echo "build for $REPO_HOME_DIR/sevntu-checkstyle-sonar-plugin/"
exit 1
fi
cd $REPO_HOME_DIR/gh-pages
echo "$manualDeploy"
return
}
if [ $# -eq 0 ]
then
echo "$usage"
fi
while :
do
case $1 in
--help | -\?)
echo "$usage"
exit 0
;;
--all)
prepareForDeploy
deployMavenLibrary
deployMavenPlugin
deployEclipse
deployIdea
deploySonar
echo "$manualDeploy"
shift 1
;;
--eclipse-cs)
prepareForDeploy
deployMavenLibrary
deployEclipse
shift 1
;;
--sonar)
prepareForDeploy
deployMavenLibrary
deploySonar
shift 1
;;
--maven)
prepareForDeploy
deployMavenLibrary
deployMavenPlugin
shift 1
;;
--idea)
prepareForDeploy
deployMavenLibrary
deployIdea
shift 1
;;
--) # End of all options
shift
break
;;
-*)
echo "WARN: Unknown option : $1"
echo "$usage"
shift
exit 0
;;
*) # no more options. Stop while loop
break
;;
esac
done