Skip to content

Commit d4ec0ff

Browse files
opensearch-trigger-bot[bot]zelinh
authored andcommitted
Update the maven snapshot publish endpoint and credential (opensearch-project#820) (opensearch-project#839)
(cherry picked from commit bc5f69d) Signed-off-by: Zelin Hao <zelinhao@amazon.com> Co-authored-by: Zelin Hao <zelinhao@amazon.com>
1 parent 7442d5c commit d4ec0ff

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ jobs:
2121
distribution: temurin # Temurin is a distribution of adoptium
2222
java-version: 11
2323
- uses: actions/checkout@v3
24-
- uses: aws-actions/configure-aws-credentials@v1
24+
25+
- name: Load secret
26+
uses: 1password/load-secrets-action@v2
2527
with:
26-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
27-
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
34+
2835
- name: publish snapshots to maven
2936
run: |
30-
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
31-
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
32-
echo "::add-mask::$SONATYPE_USERNAME"
33-
echo "::add-mask::$SONATYPE_PASSWORD"
3437
./gradlew publishPluginZipPublicationToSnapshotsRepository

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ buildscript {
3434
// Used to resolve build file dependencies
3535
repositories {
3636
mavenLocal()
37+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
3738
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
3839
mavenCentral()
3940
maven { url "https://plugins.gradle.org/m2/" }
@@ -165,7 +166,7 @@ publishing {
165166
repositories {
166167
maven {
167168
name = "Snapshots"
168-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
169+
url = "https://central.sonatype.com/repository/maven-snapshots/"
169170
credentials {
170171
username "$System.env.SONATYPE_USERNAME"
171172
password "$System.env.SONATYPE_PASSWORD"
@@ -197,6 +198,7 @@ publishing {
197198

198199
repositories {
199200
mavenLocal()
201+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
200202
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
201203
mavenCentral()
202204
maven { url "https://plugins.gradle.org/m2/" }

0 commit comments

Comments
 (0)