blob: e3ce3bc3e4693f5add1bd4578d3462484bc3e066 [file] [log] [blame]
Thomas Vachuskae8f14322019-01-02 13:52:38 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Publishes the Apache Karaf tar.gz into Maven central repository.
4# -----------------------------------------------------------------------------
5
6[ $# -ne 2 ] && echo "usage: $(basename $0) karaf-tar-file karaf-version" >&2 && exit 1
7[ -z "$SONATYPE_USER" ] && echo "SONATYPE_USER not defined" >&2 && exit 1
8[ -z "$SONATYPE_PASSWORD" ] && echo "SONATYPE_PASSWORD not defined" >&2 && exit 1
9
10TAR=$1
11VERSION=$2
12
13[ ! -f $TAR ] && echo "$TAR is not a valid file" >&2 && exit 1
14
15BASE_ARTIFACT_NAME="apache-karaf-offline"
16UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/apache-karaf-offline/$VERSION"
17
18# Make the signature file
19gpg --armor --detach-sig $TAR
20
21# Make the MD5 checksum file
22md5 -q $TAR >$TAR.md5
23
24# Make the SHA1 checksum file
25( shasum $TAR | cut -d' ' -f1 ) > $TAR.sha1
26
27curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz
28curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.asc $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.asc
29curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.md5 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.md5
30curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.sha1 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.sha1
31
32echo "$TAR has been uploaded as version $VERSION."
33echo "Please inspect the Nexus staging repository before closing it and releasing it."