Skip to content

Commit 224eb2a

Browse files
authored
Update the maven snapshot publish endpoint and credential (#5419)
Signed-off-by: Zelin Hao <[email protected]>
1 parent 8892cfb commit 224eb2a

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.github/workflows/maven-publish.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ 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 --no-daemon publishPluginZipPublicationToSnapshotsRepository publishShadowPublicationToSnapshotsRepository

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ buildscript {
4848
mavenLocal()
4949
mavenCentral()
5050
maven { url "https://plugins.gradle.org/m2/" }
51+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
5152
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
5253
maven { url "https://artifacts.opensearch.org/snapshots/lucene/" }
5354
maven { url "https://build.shibboleth.net/nexus/content/groups/public" }
@@ -422,7 +423,7 @@ publishing {
422423
repositories {
423424
maven {
424425
name = "Snapshots" // optional target repository name
425-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
426+
url = "https://central.sonatype.com/repository/maven-snapshots/"
426427
credentials {
427428
username "$System.env.SONATYPE_USERNAME"
428429
password "$System.env.SONATYPE_PASSWORD"
@@ -503,6 +504,7 @@ allprojects {
503504
mavenLocal()
504505
mavenCentral()
505506
maven { url "https://plugins.gradle.org/m2/" }
507+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
506508
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
507509
maven { url "https://artifacts.opensearch.org/snapshots/lucene/" }
508510
maven { url "https://build.shibboleth.net/nexus/content/repositories/releases" }

bwc-test/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ buildscript {
5151
}
5252
repositories {
5353
mavenLocal()
54+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
5455
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
5556
mavenCentral()
5657
maven { url "https://plugins.gradle.org/m2/" }
@@ -63,6 +64,7 @@ buildscript {
6364

6465
repositories {
6566
mavenLocal()
67+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
6668
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
6769
mavenCentral()
6870
maven { url "https://plugins.gradle.org/m2/" }

sample-resource-plugin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ ext {
5555
repositories {
5656
mavenLocal()
5757
mavenCentral()
58+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
5859
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
5960
}
6061

spi/build.gradle

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

@@ -80,7 +81,7 @@ publishing {
8081
repositories {
8182
maven {
8283
name = "Snapshots"
83-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
84+
url = "https://central.sonatype.com/repository/maven-snapshots/"
8485
credentials {
8586
username "$System.env.SONATYPE_USERNAME"
8687
password "$System.env.SONATYPE_PASSWORD"

0 commit comments

Comments
 (0)