Skip to content

Commit 3a82676

Browse files
committed
chore: new publishing
1 parent 5db4b2c commit 3a82676

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed

.github/workflows/release.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ 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 Sonatype
20-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info -Pversion=${{ github.event.release.tag_name }}
19+
- name: Publish with Gradle to Maven Central
20+
run: ./gradlew publish jreleaserDeploy --info -Pversion=${{ github.event.release.tag_name }}
2121
env:
2222
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
23-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
24-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
25-
ORG_GRADLE_PROJECT_sonatypePassword : ${{ secrets.SONATYPE_PASSWORD }}
23+
SIGNING_PUBLIC_KEY: ${{ secrets.SIGNING_PUBLIC_KEY }}
24+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
25+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
26+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}

build.gradle

+35-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'com.google.protobuf' version '0.9.5' apply false
33
id 'com.avast.gradle.docker-compose' version '0.17.12' apply false
4-
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
4+
id 'org.jreleaser' version '1.18.0'
55
}
66

77
allprojects {
@@ -14,17 +14,11 @@ ext {
1414
protobufVersion = '3.25.7'
1515
}
1616

17-
nexusPublishing {
18-
repositories {
19-
sonatype()
20-
}
21-
}
22-
2317
subprojects {
2418
apply plugin: 'java'
2519
apply plugin: 'java-library'
2620
apply plugin: 'maven-publish'
27-
apply plugin: 'signing'
21+
apply plugin: 'org.jreleaser'
2822

2923
sourceCompatibility = JavaVersion.VERSION_1_8
3024

@@ -81,14 +75,42 @@ subprojects {
8175
}
8276
}
8377
}
78+
repositories {
79+
maven {
80+
url = layout.buildDirectory.dir('staging-deploy')
81+
}
82+
}
8483
}
8584
}
8685

87-
signing {
88-
String base64Key = System.getenv('SIGNING_KEY')
89-
if (base64Key) {
90-
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
91-
sign publishing.publications
86+
jreleaser {
87+
signing {
88+
active = 'ALWAYS'
89+
armored = true
90+
String base64Key = System.getenv('SIGNING_KEY')
91+
if (base64Key) {
92+
secretKey = new String(Base64.decoder.decode(base64Key))
93+
}
94+
String base64PublicKey = System.getenv('SIGNING_PUBLIC_KEY')
95+
if (base64PublicKey) {
96+
publicKey = new String(Base64.decoder.decode(base64PublicKey))
97+
}
98+
}
99+
deploy {
100+
maven {
101+
mavenCentral {
102+
sonatype {
103+
active = 'ALWAYS'
104+
url = 'https://central.sonatype.com/api/v1/publisher'
105+
stagingRepository('build/staging-deploy')
106+
}
107+
}
108+
}
109+
}
110+
release {
111+
github {
112+
enabled = false
113+
}
92114
}
93115
}
94116
}

0 commit comments

Comments
 (0)