Thomas Vachuska | e8f1432 | 2019-01-02 13:52:38 -0800 | [diff] [blame] | 1 | #!/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 | |
| 10 | TAR=$1 |
| 11 | VERSION=$2 |
| 12 | |
| 13 | [ ! -f $TAR ] && echo "$TAR is not a valid file" >&2 && exit 1 |
| 14 | |
| 15 | BASE_ARTIFACT_NAME="apache-karaf-offline" |
| 16 | UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/apache-karaf-offline/$VERSION" |
| 17 | |
| 18 | # Make the signature file |
| 19 | gpg --armor --detach-sig $TAR |
| 20 | |
| 21 | # Make the MD5 checksum file |
| 22 | md5 -q $TAR >$TAR.md5 |
| 23 | |
| 24 | # Make the SHA1 checksum file |
| 25 | ( shasum $TAR | cut -d' ' -f1 ) > $TAR.sha1 |
| 26 | |
| 27 | curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz |
| 28 | curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.asc $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.asc |
| 29 | curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.md5 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.md5 |
| 30 | curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $TAR.sha1 $UPLOAD_BASE/$BASE_ARTIFACT_NAME-$VERSION.tar.gz.sha1 |
| 31 | |
| 32 | echo "$TAR has been uploaded as version $VERSION." |
| 33 | echo "Please inspect the Nexus staging repository before closing it and releasing it." |