Skip to content

Commit 4201f9e

Browse files
Update the maven snapshot publish endpoint and credential (#748) (#752)
(cherry picked from commit c12f41b) Signed-off-by: Zelin Hao <zelinhao@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent aa774b1 commit 4201f9e

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/maven-publish.yml

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

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ buildscript {
2929
mavenLocal()
3030
mavenCentral()
3131
maven { url "https://plugins.gradle.org/m2/" }
32+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
3233
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
3334
}
3435

@@ -51,6 +52,7 @@ repositories {
5152
mavenLocal()
5253
mavenCentral()
5354
maven { url "https://plugins.gradle.org/m2/" }
55+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
5456
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
5557
}
5658
apply plugin: 'java'
@@ -105,7 +107,7 @@ publishing {
105107
repositories {
106108
maven {
107109
name = "Snapshots"
108-
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
110+
url = "https://central.sonatype.com/repository/maven-snapshots/"
109111
credentials {
110112
username "$System.env.SONATYPE_USERNAME"
111113
password "$System.env.SONATYPE_PASSWORD"

0 commit comments

Comments
 (0)