Skip to content

Commit a74530a

Browse files
Onboarding new maven snapshots publishing to s3 (spring-data-opensearch) (#569)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 0bfb213 commit a74530a

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.github/workflows/publish-snapshots.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@ jobs:
2626
export-env: true
2727
env:
2828
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
29-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
30-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
29+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
30+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
31+
- name: Configure AWS credentials
32+
uses: aws-actions/configure-aws-credentials@v5
33+
with:
34+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
35+
aws-region: us-east-1
3136
- name: publish snapshots to Apache Maven repositories
3237
run: |
3338
./gradlew --no-daemon publishPublishMavenPublicationToSnapshotsRepository

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ If you'd rather like the latest snapshots of the upcoming major version, use our
360360
<repository>
361361
<id>opensearch-libs-snapshot</id>
362362
<name>AWS Snapshot Repository</name>
363-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
363+
<url>https://ci.opensearch.org/ci/dbc/snapshots/maven/</url>
364364
</repository>
365365
```
366366

@@ -387,7 +387,7 @@ dependencies {
387387
repositories {
388388
...
389389
maven {
390-
url = "https://central.sonatype.com/repository/maven-snapshots/"
390+
url = "https://ci.opensearch.org/ci/dbc/snapshots/maven/"
391391
}
392392
...
393393
}

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ The release process is standard across repositories in this org and is run by a
4141
1. Increment "version" in [version.properties](./version.properties) to the next iteration, e.g. v2.1.1. See [example](https://github.com/opensearch-project/spring-data-opensearch/pull/75).
4242

4343
## Snapshot Builds
44-
The [snapshots builds](https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/opensearch/client/spring-data-opensearch/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch triggers this workflow.
44+
The [snapshots builds](https://ci.opensearch.org/ci/dbc/snapshots/maven/org/opensearch/client/spring-data-opensearch/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch triggers this workflow.

buildSrc/src/main/kotlin/java-conventions.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ tasks.test {
111111
publishing {
112112
repositories {
113113
if (version.toString().endsWith("SNAPSHOT")) {
114-
maven("https://central.sonatype.com/repository/maven-snapshots/") {
114+
maven(providers.environmentVariable("MAVEN_SNAPSHOTS_S3_REPO")) {
115115
name = "Snapshots"
116-
credentials {
117-
username = System.getenv("SONATYPE_USERNAME")
118-
password = System.getenv("SONATYPE_PASSWORD")
116+
credentials(AwsCredentials::class) {
117+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
118+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
119+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
119120
}
120121
}
121122
}
@@ -149,4 +150,4 @@ val integrationTestTask = tasks.register<Test>("integrationTest") {
149150
tasks.check {
150151
dependsOn(integrationTestTask, "javadoc")
151152
finalizedBy("jacocoTestReport")
152-
}
153+
}

0 commit comments

Comments
 (0)