-
Notifications
You must be signed in to change notification settings - Fork 2
/
release-apiman.sh
executable file
·319 lines (254 loc) · 11.1 KB
/
release-apiman.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#!/bin/sh
set -e -o pipefail -x
echo "---------------------------------------------------"
echo " Releasing apiman. Many steps to follow. Please"
echo " play along at home..."
echo "---------------------------------------------------"
echo ""
echo ""
echo "---------------------------------------------------"
echo " Tell me what version we're releasing!"
echo "---------------------------------------------------"
echo ""
RELEASE_VERSION=$1
DEV_VERSION=$2
BRANCH=$3
GPG_PASSPHRASE=$4
SED="sed"
export MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx4094M"
# If using macOS then look for gsed
if [[ "$OSTYPE" == "darwin"* ]];
then
SED="gsed"
if [[ -x "gsed" ]];
then
echo "Install gsed: brew install gsed"
exit -1;
fi
fi
echo "Using sed: $SED"
if [ "x$RELEASE_VERSION" = "x" ]
then
read -p "Release Version: " RELEASE_VERSION
fi
if [ "x$DEV_VERSION" = "x" ]
then
read -p "New Development Version: " DEV_VERSION
fi
if [ "x$BRANCH" = "x" ]
then
read -p "Release Branch: [master] " BRANCH
fi
if [ "x$BRANCH" = "x" ]
then
BRANCH=master
fi
if [ "x$GPG_PASSPHRASE" = "x" ]
then
read -s -p "GPG Passphrase: " GPG_PASSPHRASE
fi
echo "######################################"
echo "Release Version: $RELEASE_VERSION"
echo "Dev Version: $DEV_VERSION"
echo "Release Branch: $BRANCH"
echo "######################################"
echo ""
echo "---------------------------------------------------"
echo " Resetting 'target' directory."
echo "---------------------------------------------------"
echo ""
rm -rf target
mkdir target
echo "---------------------------------------------------"
echo " Checking out required apiman git repos."
echo "---------------------------------------------------"
echo ""
mkdir target/git-repos
cd target/git-repos
git clone [email protected]:apiman/apiman-plugin-registry.git
git clone [email protected]:apiman/apiman-api-catalog.git
git clone [email protected]:apiman/apiman.git
git clone [email protected]:apiman/apiman-plugins.git
git clone [email protected]:apiman/apiman-wildfly-docker.git
git clone [email protected]:apiman/apiman-deployer.git
git clone [email protected]:apiman/apiman-quickstarts.git
echo "---------------------------------------------------"
echo " Update version #s and validate all builds"
echo "---------------------------------------------------"
rm -rf ~/.m2/repository/io/apiman
pushd .
cd apiman
git checkout $BRANCH
mvn versions:set -DnewVersion=$RELEASE_VERSION
find . -name '*.versionsBackup' -exec rm -f {} \;
mvn clean install
popd
pushd .
cd apiman-plugins
git checkout $BRANCH
$SED -i "s/<version.apiman>.*<\/version.apiman>/<version.apiman>$RELEASE_VERSION<\/version.apiman>/g" pom.xml
mvn versions:set -DnewVersion=$RELEASE_VERSION
find . -name '*.versionsBackup' -exec rm -f {} \;
mvn clean install
popd
pushd .
cd apiman-quickstarts
git checkout $BRANCH
mvn versions:set -DnewVersion=$RELEASE_VERSION
find . -name '*.versionsBackup' -exec rm -f {} \;
mvn clean install
popd
echo "---------------------------------------------------"
echo " Release apiman-plugin-registry"
echo "---------------------------------------------------"
pushd .
cd apiman-plugin-registry
git checkout $BRANCH
$SED -i -r "s/\"version\".?:.?\".*\"/\"version\" : \"$RELEASE_VERSION\"/g" registry.json
git add .
git commit -m "Prepare for release $RELEASE_VERSION"
git push origin $BRANCH
git tag -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
git push origin $RELEASE_VERSION
$SED -i -r "s/\"version\".?:.?\".*\"/\"version\" : \"$DEV_VERSION\"/g" registry.json
git add .
git commit -m "Update to next development version: $DEV_VERSION"
git push origin $BRANCH
popd
echo "---------------------------------------------------"
echo " Release apiman-api-catalog"
echo "---------------------------------------------------"
pushd .
cd apiman-api-catalog
git checkout $BRANCH
git tag -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
git push origin $RELEASE_VERSION
popd
echo "---------------------------------------------------"
echo " Release apiman"
echo "---------------------------------------------------"
pushd .
cd apiman
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/cdn.rawgit.com\/apiman\/apiman-plugin-registry\/$RELEASE_VERSION\/registry.json/g" distro/wildfly10/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/cdn.rawgit.com\/apiman\/apiman-api-catalog\/$RELEASE_VERSION\/catalog.json/g" distro/wildfly10/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/cdn.rawgit.com\/apiman\/apiman-plugin-registry\/$RELEASE_VERSION\/registry.json/g" distro/wildfly11/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/cdn.rawgit.com\/apiman\/apiman-api-catalog\/$RELEASE_VERSION\/catalog.json/g" distro/wildfly11/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/cdn.rawgit.com\/apiman\/apiman-plugin-registry\/$RELEASE_VERSION\/registry.json/g" distro/tomcat8/src/main/resources/overlay/conf/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/cdn.rawgit.com\/apiman\/apiman-api-catalog\/$RELEASE_VERSION\/catalog.json/g" distro/tomcat8/src/main/resources/overlay/conf/apiman.properties
git add . --all
git commit -m "Prepared apiman for release: $RELEASE_VERSION"
git push origin $BRANCH
git tag -a -m "Tagging release $RELEASE_VERSION" apiman-$RELEASE_VERSION
git push origin apiman-$RELEASE_VERSION
mvn clean install
mvn deploy -DskipTests -T2C -Prelease -Dgpg.passphrase=$GPG_PASSPHRASE
rm -rf ~/.apiman
mkdir ~/.apiman
mkdir ~/.apiman/releases
cp distro/wildfly10/target/*.zip ~/.apiman/releases
cp distro/wildfly11/target/*.zip ~/.apiman/releases
cp distro/eap7/target/*.zip ~/.apiman/releases
cp distro/tomcat8/target/*.zip ~/.apiman/releases
cp distro/vertx/target/*.zip ~/.apiman/releases
mvn versions:set -DnewVersion=$DEV_VERSION
find . -name '*.versionsBackup' -exec rm -f {} \;
git add .
git commit -m "Update to next development version: $DEV_VERSION"
git push origin $BRANCH
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/rawgit.com\/apiman\/apiman-plugin-registry\/$BRANCH\/registry.json/g" distro/wildfly10/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/rawgit.com\/apiman\/apiman-api-catalog\/$BRANCH\/catalog.json/g" distro/wildfly10/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/rawgit.com\/apiman\/apiman-plugin-registry\/$BRANCH\/registry.json/g" distro/wildfly11/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/rawgit.com\/apiman\/apiman-api-catalog\/$BRANCH\/catalog.json/g" distro/wildfly11/src/main/resources/overlay/standalone/configuration/apiman.properties
$SED -i "s/apiman-manager.plugins.registries=.*$/apiman-manager.plugins.registries=https:\/\/rawgit.com\/apiman\/apiman-plugin-registry\/$BRANCH\/registry.json/g" distro/tomcat8/src/main/resources/overlay/conf/apiman.properties
$SED -i "s/apiman-manager.api-catalog.catalog-url=.*$/apiman-manager.api-catalog.catalog-url=https:\/\/rawgit.com\/apiman\/apiman-api-catalog\/$BRANCH\/catalog.json/g" distro/tomcat8/src/main/resources/overlay/conf/apiman.properties
git add .
git commit -m "Set plugin-registry and api-catalog URLs to dev versions."
git push origin $BRANCH
popd
echo "---------------------------------------------------"
echo " Upload apiman distro to jboss.org"
echo "---------------------------------------------------"
pushd .
cd ~/.apiman/releases
echo "Now connecting to jboss.org:"
echo ""
sftp [email protected]:downloads_htdocs/overlord/apiman <<EOF
mkdir $RELEASE_VERSION
cd $RELEASE_VERSION
put apiman-distro-wildfly10-$RELEASE_VERSION-overlay.zip
put apiman-distro-wildfly11-$RELEASE_VERSION-overlay.zip
put apiman-distro-eap7-$RELEASE_VERSION-overlay.zip
put apiman-distro-tomcat8-$RELEASE_VERSION-overlay.zip
put apiman-distro-vertx-$RELEASE_VERSION.zip
EOF
popd
echo "---------------------------------------------------"
echo " Release apiman-plugins"
echo "---------------------------------------------------"
pushd .
cd apiman-plugins
git checkout $BRANCH
$SED -i "s/<version.apiman>.*<\/version.apiman>/<version.apiman>$RELEASE_VERSION<\/version.apiman>/g" pom.xml
git add . --all
git commit -m "Prepared apiman for release: $RELEASE_VERSION"
git push origin $BRANCH
git tag -a -m "Tagging release $RELEASE_VERSION" apiman-plugins-$RELEASE_VERSION
git push origin apiman-plugins-$RELEASE_VERSION
mvn clean install
mvn deploy -DskipTests -T2C -Prelease -Dgpg.passphrase=$GPG_PASSPHRASE
mvn versions:set -DnewVersion=$DEV_VERSION
find . -name '*.versionsBackup' -exec rm -f {} \;
git add .
git commit -m "Update to next development version: $DEV_VERSION"
git push origin $BRANCH
popd
# echo "---------------------------------------------------"
# echo " Release apiman-quickstarts"
# echo "---------------------------------------------------"
# pushd .
# cd apiman-quickstarts
# git checkout $BRANCH
#
# git add . --all
# git commit -m "Prepared apiman for release: $RELEASE_VERSION"
# git push origin $BRANCH
# git tag -a -m "Tagging release $RELEASE_VERSION" apiman-plugins-$RELEASE_VERSION
# git push origin apiman-plugins-$RELEASE_VERSION
#
# mvn clean deploy -Prelease -Dgpg.passphrase=$GPG_PASSPHRASE
#
# mvn versions:set -DnewVersion=$DEV_VERSION
# find . -name '*.versionsBackup' -exec rm -f {} \;
# git add .
# git commit -m "Update to next development version: $DEV_VERSION"
# git push origin $BRANCH
# popd
echo "---------------------------------------------------"
echo " Release apiman-deployer script"
echo "---------------------------------------------------"
pushd .
cd apiman-deployer
git checkout $BRANCH
$SED -i "s/APIMAN_VERSION=.*$/APIMAN_VERSION=$RELEASE_VERSION/g" deployer.sh
git add .
git commit -m "Prepare for release $RELEASE_VERSION"
git push origin $BRANCH
git tag -a -m "Tagging release $RELEASE_VERSION" $RELEASE_VERSION
git push origin $RELEASE_VERSION
$SED -i "s/APIMAN_VERSION=.*$/APIMAN_VERSION=$DEV_VERSION/g" deployer.sh
git add .
git commit -m "Update to next development version: $DEV_VERSION"
git push origin $BRANCH
popd
echo ""
echo ""
echo "---------------------------------------------------"
echo " ALL DONE!"
echo ""
echo " Remaining release tasks:"
echo " * Release a new Dockerfile"
echo " * Release the appropriate version in JIRA"
echo " * Update the website"
echo " * Send a tweet!"
echo " * Send an email to apiman-users mailing list"
echo "---------------------------------------------------"