Skip to content

Commit a4c7e62

Browse files
rupal-bqgithub-actions[bot]
authored andcommitted
Add publish to maven workflow (#651)
Signed-off-by: Rupal Mahajan <[email protected]> (cherry picked from commit 1c7a917)
1 parent 20d1c86 commit a4c7e62

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.github/workflows/maven-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish snapshots to maven
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [
7+
main
8+
1.*
9+
2.*
10+
]
11+
12+
jobs:
13+
build-and-publish-snapshots:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
id-token: write
18+
contents: write
19+
20+
steps:
21+
- uses: actions/setup-java@v3
22+
with:
23+
distribution: temurin # Temurin is a distribution of adoptium
24+
java-version: 11
25+
- uses: actions/checkout@v3
26+
- uses: aws-actions/configure-aws-credentials@v1
27+
with:
28+
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
29+
aws-region: us-east-1
30+
- name: publish snapshots to maven
31+
run: |
32+
export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text)
33+
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
34+
echo "::add-mask::$SONATYPE_USERNAME"
35+
echo "::add-mask::$SONATYPE_PASSWORD"
36+
./gradlew publishPluginZipPublicationToSnapshotsRepository

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ publishing {
9696
}
9797
}
9898
}
99+
repositories {
100+
maven {
101+
name = "Snapshots" // optional target repository name
102+
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
103+
credentials {
104+
username "$System.env.SONATYPE_USERNAME"
105+
password "$System.env.SONATYPE_PASSWORD"
106+
}
107+
}
108+
}
99109
}
100110

101111
allOpen {

0 commit comments

Comments
 (0)