Add a meta-script to build a new buck release

Change-Id: I68673f9afc52fdf033ba2c71ebacfd071404693a
diff --git a/tools/build/buck-publish b/tools/build/buck-publish
new file mode 100755
index 0000000..8d9d84d
--- /dev/null
+++ b/tools/build/buck-publish
@@ -0,0 +1,31 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Build and publish the ONOS version of buck.
+# -----------------------------------------------------------------------------
+
+if [ $# -ne 3  -a $# -ne 4 ]; then
+    echo "Usage: buck-publish-setup buck-branch onos-branch yang-branch [version] [--dry-run]"
+    echo "For example, to build buck branch 11-11-2016, onos branch master, and onos-yang-tools master:"
+    echo "buck-publish 11-11-2016 master master"
+    exit 1
+fi
+
+if [ $# -eq 4 -a "${4}" != "--dry-run" ]; then
+    echo "$4 is an invalid parameter - only --dry-run allowed"
+    exit 1
+fi
+
+BUCK_BRANCH="$1"
+ONOS_BRANCH="$2"
+YANG_BRANCH="$3"
+
+if [ -z "$4" ]; then
+    onos-release-prerequisites
+fi
+
+DIR=$(mktemp -d /tmp/buck-publish.XXXXX) || { echo "Failed to create temp file"; exit 1; }
+
+buck-publish-setup $BUCK_BRANCH $ONOS_BRANCH $YANG_BRANCH $DIR
+pushd $DIR && buck-publish-package $4 && popd
+
+