Skip to content

Commit 5524cc0

Browse files
[Backport 2.19] Onboarding new maven snapshots publishing to s3 (common-utils) (opensearch-project#885)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 28515f8 commit 5524cc0

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

.github/workflows/maven-publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ jobs:
3232
export-env: true
3333
env:
3434
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
35-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
36-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
35+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
36+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
37+
38+
- name: Configure AWS credentials
39+
uses: aws-actions/configure-aws-credentials@v5
40+
with:
41+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
42+
aws-region: us-east-1
3743

3844
- name: publish snapshots to maven
3945
run: |

build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ buildscript {
1616
mavenLocal()
1717
mavenCentral()
1818
maven { url "https://plugins.gradle.org/m2/" }
19-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
20-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
19+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
2120
}
2221

2322
dependencies {
@@ -38,8 +37,7 @@ repositories {
3837
mavenLocal()
3938
mavenCentral()
4039
maven { url "https://plugins.gradle.org/m2/" }
41-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
42-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
40+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
4341
}
4442

4543
allprojects {
@@ -181,10 +179,11 @@ publishing {
181179
}
182180
maven {
183181
name = "Snapshots"
184-
url = "https://central.sonatype.com/repository/maven-snapshots/"
185-
credentials {
186-
username "$System.env.SONATYPE_USERNAME"
187-
password "$System.env.SONATYPE_PASSWORD"
182+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
183+
credentials(AwsCredentials) {
184+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
185+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
186+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
188187
}
189188
}
190189
}

0 commit comments

Comments
 (0)