Skip to content

Commit 61f3661

Browse files
authored
Update the maven snapshot publish endpoint and credential (#1433)
Signed-off-by: Zelin Hao <[email protected]>
1 parent a7c4616 commit 61f3661

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.github/workflows/maven-publish.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ jobs:
2222
distribution: temurin # Temurin is a distribution of adoptium
2323
java-version: 21
2424
- uses: actions/checkout@v4
25-
- uses: aws-actions/configure-aws-credentials@v4
25+
- name: Load secret
26+
uses: 1password/load-secrets-action@v2
2627
with:
27-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
28-
aws-region: us-east-1
28+
# Export loaded secrets as environment variables
29+
export-env: true
30+
env:
31+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
32+
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
33+
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
2934
- name: publish snapshots to maven
3035
run: |
31-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
32-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
33-
echo "::add-mask::$SONATYPE_USERNAME"
34-
echo "::add-mask::$SONATYPE_PASSWORD"
3536
./gradlew publishPluginZipPublicationToSnapshotsRepository
3637
./gradlew publishShadowPublicationToSnapshotsRepository

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ buildscript {
7373
mavenLocal()
7474
mavenCentral()
7575
maven { url "https://plugins.gradle.org/m2/" }
76+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
7677
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
7778
}
7879

@@ -257,6 +258,7 @@ dependencies {
257258

258259
repositories {
259260
mavenLocal()
261+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
260262
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
261263
}
262264

@@ -285,7 +287,7 @@ publishing {
285287
repositories {
286288
maven {
287289
name = "Snapshots"
288-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
290+
url = "https://central.sonatype.com/repository/maven-snapshots/"
289291
credentials {
290292
username "$System.env.SONATYPE_USERNAME"
291293
password "$System.env.SONATYPE_PASSWORD"

spi/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ repositories {
5050
mavenLocal()
5151
mavenCentral()
5252
maven { url "https://plugins.gradle.org/m2/" }
53+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
5354
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
5455
}
5556

@@ -118,7 +119,7 @@ publishing {
118119
}
119120
maven {
120121
name = "Snapshots"
121-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
122+
url = "https://central.sonatype.com/repository/maven-snapshots/"
122123
credentials {
123124
username "$System.env.SONATYPE_USERNAME"
124125
password "$System.env.SONATYPE_PASSWORD"

0 commit comments

Comments
 (0)