Skip to content

Commit bc35fba

Browse files
peterzhuamazonnishtham-amazon
authored andcommitted
Onboarding new maven snapshots publishing to s3 (SA) (opensearch-project#1597)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 77a6d0b commit bc35fba

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

.github/workflows/maven-publish.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: Publish snapshots to maven
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [
7-
main
8-
1.*
9-
2.*
10-
]
6+
branches:
7+
- 'main'
8+
- '[0-9]+.[0-9]+'
9+
- '[0-9]+.x'
1110

1211
jobs:
1312
build-and-publish-snapshots:
@@ -34,8 +33,14 @@ jobs:
3433
export-env: true
3534
env:
3635
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
37-
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username
38-
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password
36+
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
37+
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
38+
39+
- name: Configure AWS credentials
40+
uses: aws-actions/configure-aws-credentials@v5
41+
with:
42+
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
43+
aws-region: us-east-1
3944

4045
- name: publish snapshots to maven
4146
run: |

build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ buildscript {
5050
repositories {
5151
mavenLocal()
5252
mavenCentral()
53-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
54-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
53+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
5554
}
5655

5756
dependencies {
@@ -169,10 +168,11 @@ publishing {
169168
repositories {
170169
maven {
171170
name = "Snapshots"
172-
url = "https://central.sonatype.com/repository/maven-snapshots/"
173-
credentials {
174-
username "$System.env.SONATYPE_USERNAME"
175-
password "$System.env.SONATYPE_PASSWORD"
171+
url = System.getenv("MAVEN_SNAPSHOTS_S3_REPO")
172+
credentials(AwsCredentials) {
173+
accessKey = System.getenv("AWS_ACCESS_KEY_ID")
174+
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
175+
sessionToken = System.getenv("AWS_SESSION_TOKEN")
176176
}
177177
}
178178
}
@@ -181,8 +181,7 @@ publishing {
181181
repositories {
182182
mavenLocal()
183183
mavenCentral()
184-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
185-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
184+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/maven/" }
186185
}
187186

188187
sourceSets.main.java.srcDirs = ['src/main/generated','src/main/java']

0 commit comments

Comments
 (0)