blob: e7b72d13d48dcc7cb76a17373277a29b696fe77e [file] [log] [blame]
#!/usr/bin/env bash
# ============LICENSE_START=======================================================
# Copyright (C) 2018-2019 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
set -o nounset
set -o errexit
set -o pipefail
#set -o xtrace
ARTIFACTORY_URL="https://artifactory.nordix.org/artifactory"
GEODE_VERSION=$(cd geode-native ; git describe --abbrev=0 --tags | sed -r "s#rel/v(.*)#\1#")
# Make sure the Geode tag version is in agreed format.
if [[ ${GEODE_VERSION} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]$ ]] ; then
GEODE_UPSTREAM_VERSION=$(echo ${GEODE_VERSION} | awk -F "." '{print $1"."$2"."$3}')
BUILD_DATE=$(date '+%Y%m%d%H%M')
GEODE_ARTIFACT="geode_client_src-${GEODE_VERSION}-NORDIX.${BUILD_DATE}.tgz"
tar czvf ${GEODE_ARTIFACT} geode-native/
else
echo "ERROR: Incorrect geode-native tag version on the branch: ${GEODE_VERSION}"
exit 1
fi
SHA_CHECKSUM=$(shasum -a 1 ${GEODE_ARTIFACT} | awk '{ print $1 }')
SHA256_CHECKSUM=$(sha256sum ${GEODE_ARTIFACT} | awk '{ print $1 }')
MD5_CHECKSUM=$(md5sum ${GEODE_ARTIFACT} | awk '{ print $1 }')
echo "-----------------------------------------------------------"
echo -e "\nUploading ${GEODE_ARTIFACT} to geode-client area: "
echo -e "geode-client/${GEODE_UPSTREAM_VERSION}/src on artifactory.nordix.org\n"
curl -H "X-JFrog-Art-Api:${ARTIFACTORY_API_KEY}" \
-H "X-Checksum-Sha1:${SHA_CHECKSUM}" \
-H "X-Checksum-Sha256:${SHA256_CHECKSUM}" \
-H "X-Checksum-MD5:${MD5_CHECKSUM}" \
-X PUT "${ARTIFACTORY_URL}/geode-client/${GEODE_UPSTREAM_VERSION}/src/${GEODE_ARTIFACT}" \
-T ${GEODE_ARTIFACT}
echo "-----------------------------------------------------------"