-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathjuneau-release.sh
executable file
·232 lines (194 loc) · 8.12 KB
/
juneau-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
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
#!/bin/bash
# ***************************************************************************************************************************
# * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
# * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
# * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
# * with the License. You may obtain a copy of the License at *
# * *
# * http://www.apache.org/licenses/LICENSE-2.0 *
# * *
# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
# * specific language governing permissions and limitations under the License. *
# ***************************************************************************************************************************
. ~/.profile
. juneau-release-env.sh
export PATH=${X_JAVA_HOME}/bin:$PATH
echo PATH=$PATH
function fail {
echo ' '
echo '*******************************************************************************'
echo '***** FAILED ******************************************************************'
echo '*******************************************************************************'
echo ' '
exit 1;
}
function success {
echo ' '
echo '*******************************************************************************'
echo '***** SUCCESS *****************************************************************'
echo '*******************************************************************************'
echo ' '
exit 0;
}
function message {
X_DATE=$(date +'%H:%M:%S')
echo ' '
echo "-------------------------------------------------------------------------------"
echo "[$X_DATE] $1"
echo '-------------------------------------------------------------------------------'
}
function fail_with_message {
X_DATE=$(date +'%H:%M:%S')
echo ' '
echo "-------------------------------------------------------------------------------"
echo "[$X_DATE] $1"
echo '-------------------------------------------------------------------------------'
fail;
}
function yprompt {
echo ' '
echo -n "$1 (Y/n): "
read prompt
if [ "$prompt" != "Y" ] && [ "$prompt" != "y" ] && [ "$prompt" != "" ]
then
fail;
fi
}
function st {
SECONDS=0
}
function et {
echo "Execution time: ${SECONDS}s"
}
command -v wget || fail_with_message "wget not found"
command -v gpg || fail_with_message "gpg not found"
command -v /usr/local/bin/gpg || fail_with_message "gpg not found in /usr/local/bin"
command -v svn || fail_with_message "svn not found"
export GPG_TTY=$(tty)
message "Checking Java version"
java -version
yprompt "Are you using at least Java 17?";
message "Checking Maven version"
mvn -version
yprompt "Are you using at least Maven 3?"
cd ~/.m2
st
if [ "$X_CLEANM2" != "N" ] && [ "$X_CLEANM2" != "n" ]
then
message "Cleaning Maven repository"
mv repository repository-old
rm -rf repository-old &
fi
et
message "Making git folder"
st
rm -rf $X_STAGING
mkdir -p $X_STAGING
mkdir $X_STAGING/git
cd $X_STAGING/git
et
message "Cloning juneau.git"
st
git clone https://gitbox.apache.org/repos/asf/juneau.git
et
#message "Cloning juneau-website.git"
#st
#git clone https://gitbox.apache.org/repos/asf/juneau-website.git
#et
cd juneau
git config user.name $X_USERNAME
git config user.email $X_EMAIL
message "Running clean verify"
st
cd $X_STAGING/git/juneau
mvn clean verify
et
message "Running javadoc:aggregate"
st
mvn javadoc:aggregate
yprompt "Is the javadoc generation clean?"
et
message "Creating test workspace"
WORKSPACE=target/workspace
XV=${X_VERSION}-SNAPSHOT
rm -Rf $WORKSPACE
mkdir -p $WORKSPACE
ZIP_SRC=juneau-microservice/juneau-my-jetty-microservice/target/my-jetty-microservice-$XV-bin.zip
ZIP_TGT=$WORKSPACE/my-jetty-microservice
echo Unzipping $ZIP_SRC to $ZIP_TGT
unzip -o $ZIP_SRC -d $ZIP_TGT
ZIP_SRC=juneau-microservice/juneau-my-springboot-microservice/target/my-springboot-microservice-$XV-bin.zip
ZIP_TGT=$WORKSPACE/my-springboot-microservice
echo Unzipping $ZIP_SRC to $ZIP_TGT
unzip -o $ZIP_SRC -d $ZIP_TGT
ZIP_SRC=juneau-examples/juneau-examples-core/target/juneau-examples-core-$XV-bin.zip
ZIP_TGT=$WORKSPACE/juneau-examples-core
echo Unzipping $ZIP_SRC to $ZIP_TGT
unzip -o $ZIP_SRC -d $ZIP_TGT
ZIP_SRC=juneau-examples/juneau-examples-rest-jetty/target/juneau-examples-rest-jetty-$XV-bin.zip
ZIP_TGT=$WORKSPACE/juneau-examples-rest-jetty
echo Unzipping $ZIP_SRC to $ZIP_TGT
unzip -o $ZIP_SRC -d $ZIP_TGT
ZIP_SRC=juneau-examples/juneau-examples-rest-springboot/target/juneau-examples-rest-springboot-$XV-bin.zip
ZIP_TGT=$WORKSPACE/juneau-examples-rest-springboot
echo Unzipping $ZIP_SRC to $ZIP_TGT
unzip -o $ZIP_SRC -d $ZIP_TGT
yprompt "Can all workspace projecs in $X_STAGING/git/juneau/target/workspace be cleanly imported as Maven projects into Eclipse?"
message "Running deploy"
st
cd $X_STAGING/git/juneau
mvn deploy
et
message "Running release:prepare"
mvn release:prepare -DautoVersionSubmodules=true -DreleaseVersion=$X_VERSION -Dtag=$X_RELEASE -DdevelopmentVersion=$X_NEXT_VERSION
yprompt "Did the release:prepare command succeed?"
message "Running git diff"
git diff $X_RELEASE
message "Running release:perform"
st
mvn release:perform
open "https://repository.apache.org/#stagingRepositories"
et
echo "On Apache's Nexus instance, locate the staging repository for the code you just released. It should be called something like orgapachejuneau-1000."
echo "Check the Updated time stamp and click to verify its Content."
echo "IMPORTANT - When all artifacts to be deployed are in the staging repository, tick the box next to it and click Close."
echo "DO NOT CLICK RELEASE YET - the release candidate must pass [VOTE] emails on dev@juneau before we release."
echo "Once closing has finished (check with Refresh), browse to the URL of the staging repository which should be something like https://repository.apache.org/content/repositories/orgapachejuneau-1000."
echo " "
echo "Enter the staging repository name AFTER CLOSING IT!!!: orgapachejuneau-"
read prompt
export X_REPO="orgapachejuneau-$prompt";
yprompt "X_REPO = $X_REPO. Is this correct?"
message "Creating binary artifacts"
st
cd $X_STAGING
rm -rf dist
svn co https://dist.apache.org/repos/dist/dev/juneau dist
svn rm dist/source/*
svn rm dist/binaries/*
mkdir dist/source/$X_RELEASE
mkdir dist/binaries/$X_RELEASE
cd $X_STAGING/dist/source/$X_RELEASE
wget -e robots=off --recursive --no-parent --no-directories -A "*-source-release*" https://repository.apache.org/content/repositories/$X_REPO/org/apache/juneau/
mv juneau-${X_VERSION}-source-release.zip apache-juneau-${X_VERSION}-src.zip
mv juneau-${X_VERSION}-source-release.zip.asc apache-juneau-${X_VERSION}-src.zip.asc
gpg --print-md SHA512 apache-juneau-${X_VERSION}-src.zip > apache-juneau-${X_VERSION}-src.zip.sha512
rm *.sha1
rm *.md5
cd $X_STAGING/dist/binaries/$X_RELEASE
wget -e robots=off --recursive --no-parent --no-directories -A "juneau-distrib*-bin.zip*" https://repository.apache.org/content/repositories/$X_REPO/org/apache/juneau/
mv juneau-distrib-${X_VERSION}-bin.zip apache-juneau-${X_VERSION}-bin.zip
mv juneau-distrib-${X_VERSION}-bin.zip.asc apache-juneau-${X_VERSION}-bin.zip.asc
gpg --print-md SHA512 apache-juneau-${X_VERSION}-bin.zip > apache-juneau-${X_VERSION}-bin.zip.sha512
rm *.sha1
rm *.md5
cd $X_STAGING/dist
svn add source/$X_RELEASE
svn add binaries/$X_RELEASE
svn commit -m "$X_RELEASE"
et
open "https://dist.apache.org/repos/dist/dev/juneau"
yprompt "Are the files available at https://dist.apache.org/repos/dist/dev/juneau?"
echo "Voting can be started."
success;