diff --git a/.github/workflows/push-common-utils-jar.yml b/.github/workflows/push-common-utils-jar.yml deleted file mode 100644 index 6a4bc703..00000000 --- a/.github/workflows/push-common-utils-jar.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Upload Common-Utils Jar to Maven - -on: - push: - tags: - - v* -jobs: - upload-common-utils-jar: - runs-on: [ubuntu-16.04] - name: Upload common-utils Jar to Maven - steps: - - name: Checkout Repo - uses: actions/checkout@v2 - - - name: Configure AWS CLI - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Setup Java - uses: actions/setup-java@v1 - with: - java-version: '14' - - - name: Upload common-utils Jar to Maven - env: - passphrase: ${{ secrets.PASSPHRASE }} - run: | - cd .. - export JAVA14_HOME=$JAVA_HOME - aws s3 cp s3://opendistro-docs/github-actions/pgp-public-key . - aws s3 cp s3://opendistro-docs/github-actions/pgp-private-key . - - gpg --import pgp-public-key - gpg --allow-secret-key-import --import pgp-private-key - - mkdir /home/runner/.gradle - aws s3 cp s3://opendistro-docs/github-actions/gradle.properties /home/runner/.gradle/ - - cd common-utils - - ./gradlew publishShadowPublicationToSonatype-stagingRepository -Dcompiler.java=14 -Dbuild.snapshot=false -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts diff --git a/build.gradle b/build.gradle index dc33b6d9..b0a720cf 100644 --- a/build.gradle +++ b/build.gradle @@ -148,6 +148,11 @@ shadowJar { classifier = null } +shadowJar.doLast { + ant.checksum algorithm: 'md5', file: it.archivePath + ant.checksum algorithm: 'sha1', file: it.archivePath +} + task sourcesJar(type: Jar) { classifier = 'sources' from sourceSets.main.allJava @@ -197,9 +202,4 @@ publishing { gradle.startParameter.setShowStacktrace(ShowStacktrace.ALWAYS) gradle.startParameter.setLogLevel(LogLevel.DEBUG) - - signing { - required { gradle.taskGraph.hasTask("publishShadowPublicationToSonatype-stagingRepository") } - sign publishing.publications.shadow - } } diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 00000000..fdc9be57 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Copyright OpenSearch Contributors. +# SPDX-License-Identifier: Apache-2.0 + +set -ex + +function usage() { + echo "Usage: $0 [args]" + echo "" + echo "Arguments:" + echo -e "-v VERSION\t[Required] OpenSearch version." + echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'." + echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored." + echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'." + echo -e "-h help" +} + +while getopts ":h:v:s:o:a:" arg; do + case $arg in + h) + usage + exit 1 + ;; + v) + VERSION=$OPTARG + ;; + s) + SNAPSHOT=$OPTARG + ;; + o) + OUTPUT=$OPTARG + ;; + a) + ARCHITECTURE=$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 version" + usage + exit 1 +fi + +[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT +[ -z "$OUTPUT" ] && OUTPUT=artifacts + +./gradlew build -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT +./gradlew publishShadowPublicationToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT +mkdir -p $OUTPUT/maven/org/opensearch +cp -r ./build/libs $OUTPUT/maven/org/opensearch/common-utils