Skip to content

Commit 75109ae

Browse files
author
yweber
committed
added direct maven central publish
1 parent ce77dde commit 75109ae

File tree

4 files changed

+59
-24
lines changed

4 files changed

+59
-24
lines changed

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: checkout
13+
uses: actions/checkout@v2
14+
- name: setup java
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: "11"
18+
- name: Check
19+
run: ./graldew check
20+
- name: Publish to Maven Central
21+
env:
22+
SIGN_KEY: ${{ secrets.SIGN_KEY }}
23+
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }}
24+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
25+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
26+
run: ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository
27+

build.gradle.kts

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ plugins {
88
id("com.github.sgtsilvio.gradle.utf8")
99
id("com.github.sgtsilvio.gradle.metadata")
1010
id("com.github.sgtsilvio.gradle.javadoc-links")
11+
id("io.github.gradle-nexus.publish-plugin")
12+
signing
1113
}
1214

1315

@@ -112,39 +114,43 @@ tasks.javadoc {
112114
publishing {
113115
publications.register<MavenPublication>("kafkaExtensionCustomizationSdk") {
114116
from(components["java"])
117+
pom {
118+
name.set(project.name)
119+
description.set(project.description)
120+
url.set(project.metadata.organization!!.url)
121+
licenses {
122+
project.metadata.license
123+
}
124+
developers {
125+
project.metadata.developers
126+
}
127+
scm {
128+
connection.set("scm:git:git://github.com/hivemq/${project.metadata.github!!.repo}.git")
129+
developerConnection.set("scm:git:ssh://github.com/hivemq/${project.metadata.github!!.repo}.git")
130+
url.set("http://github.com/hivemq/${project.metadata.github!!.repo}/")
131+
}
132+
}
115133
}
116134
}
117135

118-
bintray {
119-
user = "${project.findProperty("bintrayUser") ?: System.getenv("BINTRAY_USER")}"
120-
key = "${project.findProperty("bintrayApiKey") ?: System.getenv("BINTRAY_API_KEY")}"
121-
dryRun = false
122-
publish = false
123-
override = false
124-
pkg.apply {
125-
userOrg = "hivemq"
126-
repo = "HiveMQ"
127-
name = project.name
128-
desc = project.description
129-
websiteUrl = metadata.url.get()
130-
issueTrackerUrl = metadata.issueManagement!!.url.get()
131-
vcsUrl = metadata.scm!!.url.get()
132-
setLicenses(metadata.license!!.shortName.get())
133-
setLabels("hivemq-kafka-extension", "sdk", "mqtt", "kafka")
134-
publicDownloadNumbers = false
135-
version.apply {
136-
released = Date().toString()
137-
gpg.apply {
138-
sign = true
139-
}
136+
nexusPublishing {
137+
repositories {
138+
sonatype {
139+
username.set("${project.findProperty("sonatypeUser") ?: System.getenv("SONATYPE_USERNAME")}")
140+
password.set("${project.findProperty("sonatypePassword") ?: System.getenv("SONATYPE_PASSWORD")}")
140141
}
141142
}
142143
}
143-
afterEvaluate {
144-
bintray.setPublications(*publishing.publications.withType<MavenPublication>().names.toTypedArray())
144+
145+
signing {
146+
val signingKey = "${project.findProperty("signingKey") ?: System.getenv("SIGN_KEY")}";
147+
val signingPassword = "${project.findProperty("signingPassword") ?: System.getenv("SIGN_KEY_PASS")}";
148+
useInMemoryPgpKeys(signingKey, signingPassword)
149+
sign(publishing.publications["kafkaExtensionCustomizationSdk"])
145150
}
146151

147152

153+
148154
/* ******************** checks ******************** */
149155

150156
license {

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ plugin.bintray.version=1.8.5
1111
plugin.utf8.version=0.1.0
1212
plugin.metadata.version=0.2.0
1313
plugin.javadoc-links.version=0.3.0
14+
plugin.io.github.gradle-nexus.publish-plugin.version=1.0.0

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pluginManagement {
77
id("com.github.sgtsilvio.gradle.utf8") version "${extra["plugin.utf8.version"]}"
88
id("com.github.sgtsilvio.gradle.metadata") version "${extra["plugin.metadata.version"]}"
99
id("com.github.sgtsilvio.gradle.javadoc-links") version "${extra["plugin.javadoc-links.version"]}"
10+
id("io.github.gradle-nexus.publish-plugin") version "${extra["plugin.io.github.gradle-nexus.publish-plugin.version"]}"
1011
}
1112
}
1213

0 commit comments

Comments
 (0)