blob: 7d74a74187dfddb006d7cfde89c071d993a696e4 [file] [log] [blame]
Ray Milkeyc9b267c2022-01-05 11:33:10 -08001#!/bin/bash
2# Copyright 2020-present Open Networking Foundation.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -eu -o pipefail
17
18if [ $# != 2 ]; then
19 echo Usage: push-karaf version directory
20 exit 1
21fi
22
23PLUGIN_VERSION=$1
24DIRECTORY=$2
25SONATYPE_USER=${SONATYPE_USER:-""}
26SONATYPE_PASSWORD=${SONATYPE_PASSWORD:-""}
27
28if [ "$SONATYPE_USER" == "" -o "$SONATYPE_PASSWORD" == "" ]; then
29 echo SONATYPE_USER and SONATYPE_PASSWORD must be set
30 exit 1
31fi
32
33PLUGIN_FILE="$DIRECTORY/apache-karaf-${PLUGIN_VERSION}.tar.gz"
34BASE_ARTIFACT_NAME="apache-karaf"
35
36UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/apache-karaf-offline/$PLUGIN_VERSION"
37
38# Make the signature file
39gpg --armor --detach-sig $PLUGIN_FILE
40
41# Make the MD5 checksum file
42md5 -q $PLUGIN_FILE >$PLUGIN_FILE.md5
43
44# Make the SHA1 checksum file
45( shasum $PLUGIN_FILE | cut -d' ' -f1 ) > $PLUGIN_FILE.sha1
46
47curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $PLUGIN_FILE $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$PLUGIN_VERSION.tar.gz
48curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $PLUGIN_FILE.asc $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$PLUGIN_VERSION.tar.gz.asc
49curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $PLUGIN_FILE.md5 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$PLUGIN_VERSION.tar.gz.md5
50curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $PLUGIN_FILE.sha1 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$PLUGIN_VERSION.tar.gz.sha1