Skip to content

Commit a3bf0f4

Browse files
ci: automated artefact publish to maven central (#1803)
* ci: automated artefact publish to maven central * ci: address review comments
1 parent 2afe309 commit a3bf0f4

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

.github/workflows/publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Set up Java
11+
uses: actions/setup-java@v3
12+
with:
13+
java-version: '8'
14+
distribution: 'zulu'
15+
cache: 'gradle'
16+
- name: Publish package
17+
env:
18+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
19+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
20+
run: ./gradlew publish

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ publishing {
166166
repositories {
167167
maven {
168168
credentials {
169-
username "$ossrhUsername"
170-
password "$ossrhPassword"
169+
username = System.getenv("MAVEN_USERNAME")
170+
password = System.getenv("MAVEN_PASSWORD")
171171
}
172172
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
173173
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/'"

0 commit comments

Comments
 (0)