Upload ONOS release artifacts to maven central

Change-Id: Ie7077f017577629a4cc5f54cf7d827b918eef9d0
(cherry picked from commit b4f1cf099d84423f45bb67cbcbb41dce4d0974a7)
diff --git a/tools/build/onos-upload-bits b/tools/build/onos-upload-bits
index 367fc1d..d74deb8 100755
--- a/tools/build/onos-upload-bits
+++ b/tools/build/onos-upload-bits
@@ -8,8 +8,6 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
-#FIXME need to export s3Creds
-
 # Stage the onos tar in /tmp
 rm -f $ONOS_TAR
 cp $(onos-buck build onos --show-output | tail -1 | cut -d\  -f2) $ONOS_TAR
@@ -25,4 +23,15 @@
 rm -f $ONOS_TEST_TAR
 cp $(onos-buck build //:onos-test --show-output | tail -1 | cut -d\  -f2) $ONOS_TEST_TAR
 
-onosUploadBits.py ${ONOS_VERSION%-*}
+# use this to upload to AWS
+# onosUploadBits.py ${ONOS_VERSION%-*}
+
+# use this to upload to maven central
+if echo $ONOS_VERSION | grep '-'; then
+    echo "ONOS version $ONOS_VERSION is a beta or RC. Skipping publishing .tar.gz files"
+    exit 0
+fi
+UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/onos-releases/$ONOS_VERSION"
+curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $ONOS_TAR $UPLOAD_BASE/onos-$ONOS_VERSION.tar.gz
+curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $ONOS_TEST_TAR $UPLOAD_BASE/onos-test-$ONOS_VERSION.tar.gz
+curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $ONOS_ZIP $UPLOAD_BASE/onos-$ONOS_VERSION.zip
\ No newline at end of file