Skip to content

Commit 2116d4f

Browse files
Update Maven snapshots publishing endpoint and credential retrieval (#841)
Signed-off-by: Zelin Hao <zelinhao@amazon.com> (cherry picked from commit ca4fa74) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent e2ef664 commit 2116d4f

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/maven-publish.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ jobs:
2424
distribution: temurin # Temurin is a distribution of adoptium
2525
java-version: 17
2626
- uses: actions/checkout@v3
27-
- uses: aws-actions/configure-aws-credentials@v1
27+
28+
- name: Load secret
29+
uses: 1password/load-secrets-action@v2
2830
with:
29-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
30-
aws-region: us-east-1
31+
# Export loaded secrets as environment variables
32+
export-env: true
33+
env:
34+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
35+
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
36+
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
37+
3138
- name: publish snapshots to maven
3239
run: |
33-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
34-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
35-
echo "::add-mask::$SONATYPE_USERNAME"
36-
echo "::add-mask::$SONATYPE_PASSWORD"
3740
./gradlew publishShadowPublicationToSnapshotsRepository

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ buildscript {
1616
mavenLocal()
1717
mavenCentral()
1818
maven { url "https://plugins.gradle.org/m2/" }
19+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
1920
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
2021
}
2122

@@ -37,6 +38,7 @@ repositories {
3738
mavenLocal()
3839
mavenCentral()
3940
maven { url "https://plugins.gradle.org/m2/" }
41+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
4042
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
4143
}
4244

@@ -174,7 +176,7 @@ publishing {
174176
}
175177
maven {
176178
name = "Snapshots"
177-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
179+
url = "https://central.sonatype.com/repository/maven-snapshots/"
178180
credentials {
179181
username "$System.env.SONATYPE_USERNAME"
180182
password "$System.env.SONATYPE_PASSWORD"

0 commit comments

Comments
 (0)