diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index bc76a28a7d..8f5af81e7e 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -5,8 +5,8 @@ on: push: branches: - main - - 1.* - - 2.* + - '[0-9]+.[0-9]+' + - '[0-9]+.x' jobs: build-and-publish-snapshots: @@ -33,8 +33,14 @@ jobs: export-env: true env: OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username - SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password + MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo + MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v5 + with: + role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }} + aws-region: us-east-1 - name: publish snapshots to maven run: | diff --git a/build-tools/repositories.gradle b/build-tools/repositories.gradle index 4f58bef50a..b0152e2489 100644 --- a/build-tools/repositories.gradle +++ b/build-tools/repositories.gradle @@ -5,8 +5,7 @@ repositories { mavenLocal() - maven { url "https://central.sonatype.com/repository/maven-snapshots/" } - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" } mavenCentral() maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'} maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" } diff --git a/build.gradle b/build.gradle index de007ef60e..fa4526141e 100644 --- a/build.gradle +++ b/build.gradle @@ -31,8 +31,7 @@ buildscript { repositories { mavenLocal() - maven { url "https://central.sonatype.com/repository/maven-snapshots/" } - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" } mavenCentral() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" } diff --git a/client/build.gradle b/client/build.gradle index e592cd24ff..b2d5fbf8fe 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -72,10 +72,11 @@ publishing { } maven { name = "Snapshots" - url = "https://central.sonatype.com/repository/maven-snapshots/" - credentials { - username "$System.env.SONATYPE_USERNAME" - password "$System.env.SONATYPE_PASSWORD" + url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO") + credentials(AwsCredentials) { + accessKey = System.getenv("AWS_ACCESS_KEY_ID") + secretKey = System.getenv("AWS_SECRET_ACCESS_KEY") + sessionToken = System.getenv("AWS_SESSION_TOKEN") } } } diff --git a/common/build.gradle b/common/build.gradle index 67ce8dbe68..5cbf100289 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -113,10 +113,11 @@ publishing { } maven { name = "Snapshots" // optional target repository name - url = "https://central.sonatype.com/repository/maven-snapshots/" - credentials { - username "$System.env.SONATYPE_USERNAME" - password "$System.env.SONATYPE_PASSWORD" + url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO") + credentials(AwsCredentials) { + accessKey = System.getenv("AWS_ACCESS_KEY_ID") + secretKey = System.getenv("AWS_SECRET_ACCESS_KEY") + sessionToken = System.getenv("AWS_SESSION_TOKEN") } } } diff --git a/plugin/build.gradle b/plugin/build.gradle index 57138307b1..e2ef299232 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -163,10 +163,11 @@ publishing { mavenCentral() maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" } name = "Snapshots" - url = "https://central.sonatype.com/repository/maven-snapshots/" - credentials { - username "$System.env.SONATYPE_USERNAME" - password "$System.env.SONATYPE_PASSWORD" + url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO") + credentials(AwsCredentials) { + accessKey = System.getenv("AWS_ACCESS_KEY_ID") + secretKey = System.getenv("AWS_SECRET_ACCESS_KEY") + sessionToken = System.getenv("AWS_SESSION_TOKEN") } } } diff --git a/spi/build.gradle b/spi/build.gradle index c617131c2a..229aaeaec5 100644 --- a/spi/build.gradle +++ b/spi/build.gradle @@ -18,8 +18,7 @@ apply plugin: 'opensearch.java' repositories { mavenLocal() mavenCentral() - maven { url "https://central.sonatype.com/repository/maven-snapshots/" } - maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" } } ext { @@ -97,10 +96,11 @@ publishing { } maven { name = "Snapshots" // optional target repository name - url = "https://central.sonatype.com/repository/maven-snapshots/" - credentials { - username "$System.env.SONATYPE_USERNAME" - password "$System.env.SONATYPE_PASSWORD" + url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO") + credentials(AwsCredentials) { + accessKey = System.getenv("AWS_ACCESS_KEY_ID") + secretKey = System.getenv("AWS_SECRET_ACCESS_KEY") + sessionToken = System.getenv("AWS_SESSION_TOKEN") } } }