Skip to content

Commit 5c6e8fd

Browse files
Onboarding new maven snapshots publishing to s3 (common-utils) (#884)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent afa9919 commit 5c6e8fd

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.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 {
@@ -182,10 +180,11 @@ publishing {
182180
}
183181
maven {
184182
name = "Snapshots"
185-
url = "https://central.sonatype.com/repository/maven-snapshots/"
186-
credentials {
187-
username System.getenv("SONATYPE_USERNAME")
188-
password System.getenv("SONATYPE_PASSWORD")
183+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
184+
credentials(AwsCredentials) {
185+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
186+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
187+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
189188
}
190189
}
191190
}

0 commit comments

Comments
 (0)