Abort on publishing errors

Change-Id: Ie6f18a9340697ae65e5ae34df6f1ea3068dfba0d
diff --git a/tools/build/onos-buck-publish b/tools/build/onos-buck-publish
index b1928f8..879d2b6 100755
--- a/tools/build/onos-buck-publish
+++ b/tools/build/onos-buck-publish
@@ -22,6 +22,8 @@
 # Prepare artifact publish commands
 cat ${ONOS_ROOT}/tools/build/publish-target-list | grep -v '#' >> $ARTIFACT_PUB
 sed -i.bak 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB
+cp $ARTIFACT_PUB $ARTIFACT_PUB.bak
+( echo "set -e"; cat $ARTIFACT_PUB.bak ) >$ARTIFACT_PUB
 
 # Print commands to be run and then run them
 cat $ARTIFACT_PUB
@@ -34,6 +36,8 @@
 # Prepare test commands
 cat ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#' >> $TEST_PUB
 sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
+cp $TEST_PUB $TEST_PUB.bak
+( echo "set -e"; cat $TEST_PUB.bak ) >$TEST_PUB
 
 # Print commands to be run and then run them
 cat $TEST_PUB