Skip to content

Commit d7a8a65

Browse files
committed
feat: publish to maven central
1 parent f7e43a7 commit d7a8a65

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ jobs:
2727
run: ./gradlew :lib:publish
2828
env:
2929
RELEASE_VERSION: ${{ github.ref_name }}
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for GitHub Packages
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For GitHub Packages
31+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} # For Central Portal
32+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} # For Central Portal
33+
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} # For Central Portal signing
34+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} # For Central Portal signing

lib/build.gradle

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id 'java-library'
33
id 'maven-publish'
4+
id 'org.jreleaser' version '1.18.0'
45
}
56

67
repositories {
@@ -42,11 +43,33 @@ publishing {
4243
pom {
4344
name = 'Kuberesolver'
4445
description = 'gRPC name resolver for Kubernetes'
46+
url = 'https://github.com/lothar1998/kuberesolver-java'
47+
licenses {
48+
license {
49+
name = 'The Apache License, Version 2.0'
50+
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
51+
}
52+
}
53+
developers {
54+
developer {
55+
id = 'lothar1998'
56+
name = 'Piotr Kuglin'
57+
58+
}
59+
}
60+
scm {
61+
connection = 'scm:git:git://github.com/lothar1998/kuberesolver-java.git'
62+
developerConnection = 'scm:git:ssh://[email protected]:lothar1998/kuberesolver-java.git'
63+
url = 'https://github.com/lothar1998/kuberesolver-java'
64+
}
4565
}
4666
}
4767
}
4868

4969
repositories {
70+
maven {
71+
url = layout.buildDirectory.dir('staging-deploy')
72+
}
5073
maven {
5174
name = "GitHubPackages"
5275
url = uri("https://maven.pkg.github.com/lothar1998/kuberesolver-java")
@@ -57,3 +80,21 @@ publishing {
5780
}
5881
}
5982
}
83+
84+
jreleaser {
85+
signing {
86+
active = 'ALWAYS'
87+
armored = true
88+
}
89+
deploy {
90+
maven {
91+
mavenCentral {
92+
sonatype {
93+
active = 'ALWAYS'
94+
url = 'https://central.sonatype.com/api/v1/publisher'
95+
stagingRepository('target/staging-deploy')
96+
}
97+
}
98+
}
99+
}
100+
}

0 commit comments

Comments
 (0)