Skip to content

Commit 9017557

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

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ jobs:
2424
uses: gradle/actions/setup-gradle@v4
2525

2626
- name: Publish Artifact
27-
run: ./gradlew :lib:publish
27+
run: |
28+
./gradlew jreleaserConfig --git-root-search
29+
./gradlew clean
30+
./gradlew :lib:publish
31+
./gradlew :lib:jreleaserFullRelease --git-root-search
2832
env:
2933
RELEASE_VERSION: ${{ github.ref_name }}
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required for GitHub Packages
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For GitHub Packages
35+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
36+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
37+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
38+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
39+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
40+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file was generated by the Gradle 'init' task.
22
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
33

4-
org.gradle.configuration-cache=true
4+
org.gradle.configuration-cache=false
55

lib/build.gradle

Lines changed: 44 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,24 @@ publishing {
5780
}
5881
}
5982
}
83+
84+
jreleaser {
85+
project {
86+
version = System.getenv("RELEASE_VERSION") ?: "0.0.1-SNAPSHOT"
87+
}
88+
signing {
89+
active = 'ALWAYS'
90+
armored = true
91+
}
92+
deploy {
93+
maven {
94+
mavenCentral {
95+
sonatype {
96+
active = 'ALWAYS'
97+
url = 'https://central.sonatype.com/api/v1/publisher'
98+
stagingRepository('build/staging-deploy')
99+
}
100+
}
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)