diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index aabc13d4..6fb3a933 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -24,18 +24,18 @@ jobs: distribution: temurin # Temurin is a distribution of adoptium java-version: 11 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 + - name: Load secret + uses: 1password/load-secrets-action@v2 with: - role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} - aws-region: us-east-1 + # Export loaded secrets as environment variables + 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 - name: Publish snapshots to maven run: | - export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) - export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) - echo "::add-mask::$SONATYPE_USERNAME" - echo "::add-mask::$SONATYPE_PASSWORD" # For JS-SPI jar ./gradlew publishShadowPublicationToSnapshotsRepository # For JS jar diff --git a/build.gradle b/build.gradle index fe997daa..9b85353c 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,7 @@ buildscript { repositories { mavenLocal() mavenCentral() + maven { url "https://central.sonatype.com/repository/maven-snapshots/" } maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } } @@ -164,7 +165,7 @@ publishing { repositories { maven { name = "Snapshots" // optional target repository name - url = "https://aws.oss.sonatype.org/content/repositories/snapshots" + url = "https://central.sonatype.com/repository/maven-snapshots/" credentials { username "$System.env.SONATYPE_USERNAME" password "$System.env.SONATYPE_PASSWORD" @@ -176,6 +177,7 @@ publishing { repositories { mavenLocal() mavenCentral() + maven { url "https://central.sonatype.com/repository/maven-snapshots/" } maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } }