Skip to content

Commit 8895b0a

Browse files
zelinhcwperks
authored andcommitted
Update the maven snapshot publish endpoint and credential (opensearch-project#1433)
Signed-off-by: Zelin Hao <[email protected]> (cherry picked from commit 61f3661)
1 parent 4ee6a6a commit 8895b0a

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

.github/workflows/maven-publish.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ jobs:
2020
- uses: actions/setup-java@v3
2121
with:
2222
distribution: temurin # Temurin is a distribution of adoptium
23-
java-version: 11
24-
- uses: actions/checkout@v3
25-
- uses: aws-actions/configure-aws-credentials@v1
23+
java-version: 21
24+
- uses: actions/checkout@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
36-
./gradlew publishShadowPublicationToSnapshotsRepository
37+
./gradlew publishShadowPublicationToSnapshotsRepository

build.gradle

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

@@ -236,6 +237,7 @@ dependencies {
236237

237238
repositories {
238239
mavenLocal()
240+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
239241
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
240242
}
241243

@@ -264,7 +266,7 @@ publishing {
264266
repositories {
265267
maven {
266268
name = "Snapshots"
267-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
269+
url = "https://central.sonatype.com/repository/maven-snapshots/"
268270
credentials {
269271
username "$System.env.SONATYPE_USERNAME"
270272
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)