Skip to content

Commit b467d22

Browse files
Update the maven snapshot publish endpoint and credential (#3929) (#3955)
(cherry picked from commit 504c535) Co-authored-by: Zelin Hao <[email protected]>
1 parent e681c58 commit b467d22

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

.github/workflows/maven-publish.yml

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

build-tools/repositories.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
repositories {
77
mavenLocal()
8+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
89
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
910
mavenCentral()
1011
maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ buildscript {
3030

3131
repositories {
3232
mavenLocal()
33+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
3334
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
3435
mavenCentral()
3536
maven { url "https://plugins.gradle.org/m2/" }

client/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ publishing {
8181
}
8282
maven {
8383
name = "Snapshots"
84-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
84+
url = "https://central.sonatype.com/repository/maven-snapshots/"
8585
credentials {
8686
username "$System.env.SONATYPE_USERNAME"
8787
password "$System.env.SONATYPE_PASSWORD"

common/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ publishing {
117117
}
118118
maven {
119119
name = "Snapshots" // optional target repository name
120-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
120+
url = "https://central.sonatype.com/repository/maven-snapshots/"
121121
credentials {
122122
username "$System.env.SONATYPE_USERNAME"
123123
password "$System.env.SONATYPE_PASSWORD"

plugin/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ publishing {
119119
mavenCentral()
120120
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }
121121
name = "Snapshots"
122-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
122+
url = "https://central.sonatype.com/repository/maven-snapshots/"
123123
credentials {
124124
username "$System.env.SONATYPE_USERNAME"
125125
password "$System.env.SONATYPE_PASSWORD"

spi/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ apply plugin: 'opensearch.java'
1818
repositories {
1919
mavenLocal()
2020
mavenCentral()
21+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
2122
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
2223
}
2324

@@ -96,7 +97,7 @@ publishing {
9697
}
9798
maven {
9899
name = "Snapshots" // optional target repository name
99-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
100+
url = "https://central.sonatype.com/repository/maven-snapshots/"
100101
credentials {
101102
username "$System.env.SONATYPE_USERNAME"
102103
password "$System.env.SONATYPE_PASSWORD"

0 commit comments

Comments
 (0)