Skip to content

Commit f78d75d

Browse files
Xtansiazelinh
andauthored
Update the maven snapshot publish endpoint and credential (opensearch-project#1634) (opensearch-project#1639)
(cherry picked from commit 9e3d473) Signed-off-by: Zelin Hao <[email protected]> Co-authored-by: Zelin Hao <[email protected]>
1 parent 3edeb96 commit f78d75d

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

.github/workflows/publish-snapshots.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
java-version: '11'
2121
distribution: 'temurin'
2222
cache: 'gradle'
23-
- name: Configure AWS credentials
24-
uses: aws-actions/configure-aws-credentials@v4
23+
- name: Load secret
24+
uses: 1password/load-secrets-action@v2
2525
with:
26-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
27-
aws-region: us-east-1
26+
# Export loaded secrets as environment variables
27+
export-env: true
28+
env:
29+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
30+
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
31+
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
2832
- name: publish snapshots to maven
2933
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"
3434
./gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUC
5353
See [User Guide](USER_GUIDE.md).
5454

5555
## Snapshot Builds
56-
The [snapshots builds](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/client/opensearch-java/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow.
56+
The [snapshots builds](https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/opensearch/client/opensearch-java/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch triggers this workflow.
5757

5858
## Compatibility with OpenSearch
5959

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ allprojects {
3838

3939
repositories {
4040
mavenLocal()
41+
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
4142
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
4243
mavenCentral()
4344
gradlePluginPortal()

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ plugins {
3636

3737
repositories {
3838
mavenLocal()
39+
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
3940
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
4041
mavenCentral()
4142
gradlePluginPortal()

java-client/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import java.io.FileWriter
3838
buildscript {
3939
repositories {
4040
mavenLocal()
41+
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
4142
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
4243
mavenCentral()
4344
gradlePluginPortal()
@@ -320,7 +321,7 @@ tasks.withType<Jar> {
320321
publishing {
321322
repositories{
322323
if (version.toString().endsWith("SNAPSHOT")) {
323-
maven("https://aws.oss.sonatype.org/content/repositories/snapshots/") {
324+
maven("https://central.sonatype.com/repository/maven-snapshots/") {
324325
name = "Snapshots"
325326
credentials {
326327
username = System.getenv("SONATYPE_USERNAME")

java-codegen/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import java.io.FileWriter
1919
buildscript {
2020
repositories {
2121
mavenLocal()
22+
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
2223
maven(url = "https://aws.oss.sonatype.org/content/repositories/snapshots")
2324
mavenCentral()
2425
gradlePluginPortal()

0 commit comments

Comments
 (0)