2323# Print usage information
2424usage () {
2525 cat << EOF
26- Usage: $( basename " $0 " ) <release-branch> [--upload] [<svn-username> <svn-password>]
26+ Usage: $( basename " $0 " ) <release-branch> [--upload] [-rc <number>] [ <svn-username> <svn-password>]
2727 <release-branch> Release branch in format release-v<major>.<minor>.x (e.g. release-v4.0.x)
2828 --upload (Optional) Upload artifacts to Apache dist/dev SVN
29+ -rc <number> (Optional) Append -RC<number> suffix to tag when provided
2930 <svn-username> (Optional) SVN username for committing to Apache Dev repo
3031 <svn-password> (Optional) SVN password for committing to Apache Dev repo
3132
3233Example:
33- $( basename " $0 " ) release-v1 .0.x-incubating --upload my_user my_password
34+ $( basename " $0 " ) release-v4 .0.x --upload -rc 1 my_user my_password
3435EOF
3536}
3637
@@ -53,6 +54,7 @@ BRANCH="$1"
5354UPLOAD=false
5455USERNAME=" "
5556PASSWORD=" "
57+ RC_NUMBER=" "
5658SCRIPT_DIR=$( cd " $( dirname " $0 " ) " && pwd)
5759
5860verify_gpg_access () {
@@ -70,6 +72,20 @@ while [[ $# -gt 0 ]]; do
7072 UPLOAD=true
7173 shift
7274 ;;
75+ -rc)
76+ if [[ -z " $2 " ]]; then
77+ echo " ERROR: -rc requires a number argument"
78+ usage
79+ exit 1
80+ fi
81+ if [[ ! " $2 " =~ ^[1-9][0-9]* $ ]]; then
82+ echo " ERROR: -rc number must be a positive integer"
83+ usage
84+ exit 1
85+ fi
86+ RC_NUMBER=" $2 "
87+ shift 2
88+ ;;
7389 * )
7490 if [[ -z " $USERNAME " ]]; then
7591 USERNAME=" $1 "
@@ -114,6 +130,9 @@ if [[ -z "$REVISION" ]]; then
114130fi
115131
116132TAG=" v${REVISION} "
133+ if [[ -n " $RC_NUMBER " ]]; then
134+ TAG=" ${TAG} -RC${RC_NUMBER} "
135+ fi
117136if ! git rev-parse -q --verify " refs/tags/${TAG} " > /dev/null; then
118137 echo " ERROR: Tag ${TAG} not found"
119138 exit 1
@@ -150,19 +169,27 @@ echo "Signing artifacts..."
150169bash " ${SCRIPT_DIR} /sign-artifacts.sh" " $WORKDIR "
151170
152171if [ " $UPLOAD " = true ]; then
172+ UPLOAD_DIR=" ${REVISION} "
173+ if [[ -n " $RC_NUMBER " ]]; then
174+ UPLOAD_DIR=" ${REVISION} -RC${RC_NUMBER} "
175+ fi
153176 SVN_TMP=$( mktemp -d)
154177 svn checkout " $ASF_SVN_DEV_URL " " $SVN_TMP "
155- mkdir -p " $SVN_TMP /${REVISION} "
156- cp target/output/* " $SVN_TMP /${REVISION} /"
178+ mkdir -p " $SVN_TMP /${UPLOAD_DIR} "
179+ for f in " $WORKDIR " /* ; do
180+ if [[ -f " $f " ]]; then
181+ cp " $f " " $SVN_TMP /${UPLOAD_DIR} /"
182+ fi
183+ done
157184 cd " $SVN_TMP "
158- svn add --force " ${REVISION } "
185+ svn add --force " ${UPLOAD_DIR } "
159186 svn status
160187 if [ " $USERNAME " = " " ]; then
161- svn commit -m " Add release ${REVISION } " || exit
188+ svn commit -m " Add release ${UPLOAD_DIR } " || exit
162189 else
163- svn commit -m " Add release ${REVISION } " --username " ${USERNAME} " --password " ${PASSWORD} " || exit
190+ svn commit -m " Add release ${UPLOAD_DIR } " --username " ${USERNAME} " --password " ${PASSWORD} " || exit
164191 fi
165- echo " Artifacts uploaded to SVN dev: ${REVISION } "
192+ echo " Artifacts uploaded to SVN dev: ${UPLOAD_DIR } "
166193else
167194 echo " Artifacts generated under target/output and copied to $WORKDIR . Use --upload to push to SVN."
168195fi
0 commit comments