Skip to content

Commit f4ac180

Browse files
[Backport 2.19] Update the maven snapshot publish endpoint and credential (#5419) (#5452)
1 parent 61fe6e7 commit f4ac180

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/maven-publish.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@ jobs:
2222
distribution: temurin # Temurin is a distribution of adoptium
2323
java-version: 11
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: |
3136
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
3237
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
3338
echo "::add-mask::$SONATYPE_USERNAME"
3439
echo "::add-mask::$SONATYPE_PASSWORD"
35-
./gradlew publishPluginZipPublicationToSnapshotsRepository
40+
./gradlew --no-daemon publishPluginZipPublicationToSnapshotsRepository

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ buildscript {
4545
mavenLocal()
4646
mavenCentral()
4747
maven { url "https://plugins.gradle.org/m2/" }
48+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
4849
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
4950
maven { url "https://artifacts.opensearch.org/snapshots/lucene/" }
5051
maven { url "https://build.shibboleth.net/nexus/content/groups/public" }
@@ -420,7 +421,7 @@ publishing {
420421
repositories {
421422
maven {
422423
name = "Snapshots" // optional target repository name
423-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
424+
url = "https://central.sonatype.com/repository/maven-snapshots/"
424425
credentials {
425426
username "$System.env.SONATYPE_USERNAME"
426427
password "$System.env.SONATYPE_PASSWORD"
@@ -433,6 +434,7 @@ repositories {
433434
mavenLocal()
434435
mavenCentral()
435436
maven { url "https://plugins.gradle.org/m2/" }
437+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
436438
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
437439
maven { url "https://artifacts.opensearch.org/snapshots/lucene/" }
438440
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/" }

0 commit comments

Comments
 (0)