Skip to content

Commit ca4fa74

Browse files
authored
Update Maven snapshots publishing endpoint and credential retrieval (#841)
Signed-off-by: Zelin Hao <[email protected]>
1 parent cdf07c1 commit ca4fa74

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: 21
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

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

0 commit comments

Comments
 (0)