Skip to content

Commit dde2df4

Browse files
author
test user
committed
chore: new Maven central publishing
1 parent 47cee34 commit dde2df4

File tree

2 files changed

+59
-38
lines changed

2 files changed

+59
-38
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ jobs:
1616
run: chmod +x gradlew
1717
- name: Check with Gradle
1818
run: ./gradlew check --info -Pversion=${{ github.event.release.tag_name }}
19-
- name: Publish with Gradle to Gradle Plugins portal
20-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository publishPlugins --info -Pversion=${{ github.event.release.tag_name }}
19+
- name: Publish with Gradle to Maven Central and Gradle Plugins portal
20+
run: ./gradlew publish jreleaserDeploy publishPlugins --info -Pversion=${{ github.event.release.tag_name }}
2121
env:
2222
GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }}
2323
GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }}
2424
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
25-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
26-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
27-
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
25+
SIGNING_PUBLIC_KEY: ${{ secrets.SIGNING_PUBLIC_KEY }}
26+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
27+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
28+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}

build.gradle

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ plugins {
22
id 'groovy'
33
id 'maven-publish'
44
id 'java-gradle-plugin'
5-
id 'signing'
6-
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
5+
id 'org.jreleaser' version '1.18.0'
76
id 'com.gradle.plugin-publish' version '1.3.1'
87
}
98

@@ -54,46 +53,67 @@ java {
5453
}
5554

5655
afterEvaluate {
57-
publishing.publications.forEach {
58-
it.pom {
59-
name = 'Gradle Docker Java Plugin'
60-
description = 'Gradle plugin that wraps your JVM application to a new Docker image.'
61-
url = 'https://github.com/augi/gradle-docker-java'
62-
licenses {
63-
license {
64-
name = 'The MIT License'
65-
url = 'http://www.opensource.org/licenses/mit-license.php'
56+
publishing {
57+
publications.forEach {
58+
it.pom {
59+
name = 'Gradle Docker Java Plugin'
60+
description = 'Gradle plugin that wraps your JVM application to a new Docker image.'
61+
url = 'https://github.com/augi/gradle-docker-java'
62+
licenses {
63+
license {
64+
name = 'The MIT License'
65+
url = 'http://www.opensource.org/licenses/mit-license.php'
66+
}
6667
}
67-
}
68-
developers {
69-
developer {
70-
id = 'augi'
71-
name = 'Michal Augustýn'
72-
68+
developers {
69+
developer {
70+
id = 'augi'
71+
name = 'Michal Augustýn'
72+
73+
}
74+
}
75+
scm {
76+
connection = 'scm:git:git://github.com/augi/gradle-docker-java.git'
77+
developerConnection = 'scm:git:ssh://github.com/augi/gradle-docker-java.git'
78+
url = 'https://github.com/augi/gradle-docker-java'
7379
}
7480
}
75-
scm {
76-
connection = 'scm:git:git://github.com/augi/gradle-docker-java.git'
77-
developerConnection = 'scm:git:ssh://github.com/augi/gradle-docker-java.git'
78-
url = 'https://github.com/augi/gradle-docker-java'
81+
}
82+
repositories {
83+
maven {
84+
url = layout.buildDirectory.dir('staging-deploy')
7985
}
8086
}
8187
}
8288
}
8389

84-
signing {
85-
String base64Key = System.getenv('SIGNING_KEY')
86-
if (base64Key) {
87-
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
88-
sign publishing.publications
90+
jreleaser {
91+
signing {
92+
active = 'ALWAYS'
93+
armored = true
94+
String base64Key = System.getenv('SIGNING_KEY')
95+
if (base64Key) {
96+
secretKey = new String(Base64.decoder.decode(base64Key))
97+
}
98+
String base64PublicKey = System.getenv('SIGNING_PUBLIC_KEY')
99+
if (base64PublicKey) {
100+
publicKey = new String(Base64.decoder.decode(base64PublicKey))
101+
}
89102
}
90-
}
91-
92-
nexusPublishing {
93-
repositories {
94-
sonatype {
95-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
96-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
103+
deploy {
104+
maven {
105+
mavenCentral {
106+
sonatype {
107+
active = 'ALWAYS'
108+
url = 'https://central.sonatype.com/api/v1/publisher'
109+
stagingRepository('build/staging-deploy')
110+
}
111+
}
112+
}
113+
}
114+
release {
115+
github {
116+
enabled = false
97117
}
98118
}
99119
}

0 commit comments

Comments
 (0)