Skip to content

Commit 627e897

Browse files
authored
Update the maven snapshot publish endpoint and credential (#254)
Signed-off-by: Zelin Hao <[email protected]>
1 parent cad5c67 commit 627e897

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.github/workflows/publish-maven-snapshots.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ jobs:
2323
distribution: temurin
2424
java-version: 21
2525

26-
- name: Configure AWS credentials
27-
uses: aws-actions/configure-aws-credentials@v1
26+
- name: Load secret
27+
uses: 1password/load-secrets-action@v2
2828
with:
29-
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
30-
aws-region: us-east-1
29+
# Export loaded secrets as environment variables
30+
export-env: true
31+
env:
32+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
33+
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
34+
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
3135

3236
- name: Publish snapshots to maven
3337
run: |

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/opensearch-testcontainers/pull/39).
4242

4343
## Snapshot Builds
44-
The [snapshots builds](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/opensearch-testcontainers/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch (or other active release branch like `1.x`) triggers this workflow.
44+
The [snapshots builds](https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/opensearch/opensearch-testcontainers/) are published to sonatype using [publish-snapshots.yml](./.github/workflows/publish-snapshots.yml) workflow. Each `push` event to the main branch (or other active release branch like `1.x`) triggers this workflow.

build.gradle.kts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ repositories {
3939
maven {
4040
url = uri("https://repo.maven.apache.org/maven2/")
4141
}
42+
maven {
43+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
44+
}
4245
maven {
4346
url = uri("https://aws.oss.sonatype.org/content/repositories/snapshots/")
4447
}
4548
}
4649

4750
dependencies {
4851
implementation("org.testcontainers:testcontainers:1.21.1")
49-
testImplementation(platform("org.junit:junit-bom:5.13.1"))
52+
testImplementation(platform("org.junit:junit-bom:5.13.1"))
5053
testImplementation("org.junit.jupiter:junit-jupiter")
5154
testImplementation("org.junit.jupiter:junit-jupiter-params")
5255
testImplementation("ch.qos.logback:logback-classic:1.5.18")
@@ -67,14 +70,14 @@ if (isSnapshot && !buildVersion.endsWith("SNAPSHOT")) {
6770
} else if (!isSnapshot && buildVersion.endsWith("SNAPSHOT")) {
6871
throw GradleException("Expecting release (non-SNAPSHOT) build but version is not set accordingly: " + buildVersion)
6972
}
70-
71-
// Check if tag release version (if provided) matches the version from build settings
73+
74+
// Check if tag release version (if provided) matches the version from build settings
7275
val tagVersion = System.getProperty("build.version", buildVersion)
7376
if (!buildVersion.equals(tagVersion)) {
7477
throw GradleException("The tagged version " + tagVersion + " does not match the build version " + buildVersion)
7578
}
7679

77-
version = buildVersion
80+
version = buildVersion
7881
description = "Testcontainers for Opensearch"
7982

8083
java {
@@ -125,7 +128,7 @@ configure<ReleaseExtension> {
125128
publishing {
126129
repositories{
127130
if (version.toString().endsWith("SNAPSHOT")) {
128-
maven("https://aws.oss.sonatype.org/content/repositories/snapshots/") {
131+
maven("https://central.sonatype.com/repository/maven-snapshots/") {
129132
name = "snapshotRepo"
130133
credentials {
131134
username = System.getenv("SONATYPE_USERNAME")

0 commit comments

Comments
 (0)