From 6e2bb9d5584471e5dbb188215feea28c6a24de65 Mon Sep 17 00:00:00 2001 From: Vijayan Balasubramanian Date: Wed, 13 Oct 2021 16:31:07 -0700 Subject: [PATCH] Add script to publish to maven local Added script for opensearch-java to publish to maven local based on version and whether is it snapshot or not. Signed-off-by: Vijayan Balasubramanian --- .../opensearch-java/publish_to_local.sh | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 scripts/components/opensearch-java/publish_to_local.sh diff --git a/scripts/components/opensearch-java/publish_to_local.sh b/scripts/components/opensearch-java/publish_to_local.sh new file mode 100755 index 0000000000..ffc5b69227 --- /dev/null +++ b/scripts/components/opensearch-java/publish_to_local.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. + +set -ex + +function usage() { + echo "Usage: $0 [args]" + echo "" + echo "Arguments:" + echo -e "-v VERSION\t[Required] openSearch-java client version." + echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'." + echo -e "-h help" +} + +while getopts ":h:v:s:" arg; do + case $arg in + h) + usage + exit 1 + ;; + v) + VERSION=$OPTARG + ;; + s) + SNAPSHOT=$OPTARG + ;; + :) + echo "Error: -${OPTARG} requires an argument" + usage + exit 1 + ;; + ?) + echo "Invalid option: -${arg}" + exit 1 + ;; + esac +done + +if [ -z "$VERSION" ]; then + echo "Error: You must specify the opensearch-java version" + usage + exit 1 +fi + +[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT + +export VERSION=$VERSION +./gradlew publishToMavenLocal