Skip to content

Commit b58d8f6

Browse files
authored
Merge pull request #44 from embulk/release-with-jreleaser
Release with JReleaser
2 parents d8911b0 + 1145201 commit b58d8f6

File tree

6 files changed

+68
-23
lines changed

6 files changed

+68
-23
lines changed

.github/workflows/publish.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ jobs:
1818
java-version: 8
1919
distribution: "temurin"
2020
- name: Publish
21-
run: ./gradlew --stacktrace publishMavenPublicationToMavenCentralRepository
21+
run: ./gradlew --info --stacktrace jreleaserRelease
2222
env:
23-
ORG_GRADLE_PROJECT_ossrhUsername: ${{ vars.OSSRH_USERNAME }}
24-
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
25-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_ARMOR }}
26-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}
23+
JRELEASER_GPG_PUBLIC_KEY: ${{ vars.GPG_PUBLIC_KEY_ARMOR }}
24+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY_ARMOR }}
25+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSPHRASE }}
26+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ vars.MAVEN_CENTRAL_PORTAL_USERNAME }}
27+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PORTAL_PASSWORD }}

build.gradle

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ plugins {
44
id "maven-publish"
55
id "signing"
66
id "checkstyle"
7+
id("org.jreleaser") version "1.17.0"
78
}
89

910
repositories {
1011
mavenCentral()
1112
}
1213

1314
group = "org.embulk"
14-
version = "0.3.0-SNAPSHOT"
15+
version = "0.3.1-SNAPSHOT"
1516
description "Timestamp parser and formatter for Embulk and Embulk plugins"
1617

1718
configurations {
@@ -136,19 +137,13 @@ publishing {
136137
}
137138
}
138139

140+
// We release this to Maven Central with JReleaser tentatively because there is no first-party Gradle plugin yet.
141+
// https://central.sonatype.org/news/20250326_ossrh_sunset/#support-for-gradle-and-other-publishers
142+
//
143+
// Once the first-part Gradle plugin for the new Maven Central Portal is available, we will get back to the first-party.
139144
repositories {
140-
maven { // publishMavenPublicationToMavenCentralRepository
141-
name = "mavenCentral"
142-
if (project.version.endsWith("-SNAPSHOT")) {
143-
url "https://oss.sonatype.org/content/repositories/snapshots"
144-
} else {
145-
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
146-
}
147-
148-
credentials {
149-
username = project.hasProperty("ossrhUsername") ? ossrhUsername : ""
150-
password = project.hasProperty("ossrhPassword") ? ossrhPassword : ""
151-
}
145+
maven { // https://jreleaser.org/guide/latest/examples/maven/staging-artifacts.html#_gradle
146+
url = layout.buildDirectory.dir("jreleaser-staging-deploy")
152147
}
153148
}
154149
}
@@ -158,9 +153,54 @@ signing {
158153
logger.lifecycle("Signing with an in-memory key.")
159154
useInMemoryPgpKeys(signingKey, signingPassword)
160155
}
161-
sign publishing.publications.maven
156+
// Disabled: Signed directly by JReleaser when being released by JReleaser.
157+
// sign publishing.publications.maven
162158
}
163159

160+
jreleaser {
161+
release {
162+
github {
163+
enabled = true // Not intended, but needed: https://github.com/jreleaser/jreleaser/discussions/1725
164+
token = "unavailable"
165+
skipTag = true
166+
skipRelease = true
167+
}
168+
}
169+
170+
signing { // https://jreleaser.org/guide/latest/reference/signing.html
171+
active = org.jreleaser.model.Active.ALWAYS
172+
armored = true
173+
mode = org.jreleaser.model.Signing.Mode.MEMORY
174+
publicKey = System.getenv("JRELEASER_GPG_PUBLIC_KEY") ?: "N/A"
175+
secretKey = System.getenv("JRELEASER_GPG_SECRET_KEY") ?: "N/A"
176+
passphrase = System.getenv("JRELEASER_GPG_PASSPHRASE") ?: "N/A"
177+
}
178+
179+
deploy {
180+
maven {
181+
mavenCentral { // https://jreleaser.org/guide/latest/reference/deploy/maven/maven-central.html
182+
sonatype {
183+
active = org.jreleaser.model.Active.ALWAYS
184+
url = "https://central.sonatype.com/api/v1/publisher"
185+
snapshotSupported = false
186+
username = System.getenv("JRELEASER_MAVENCENTRAL_USERNAME")
187+
password = System.getenv("JRELEASER_MAVENCENTRAL_PASSWORD")
188+
authorization = "BEARER"
189+
applyMavenCentralRules = true
190+
stagingRepository("$buildDir/jreleaser-staging-deploy")
191+
retryDelay = 60
192+
maxRetries = 60
193+
}
194+
}
195+
}
196+
}
197+
}
198+
199+
jreleaserRelease.dependsOn publish
200+
jreleaserRelease.shouldRunAfter publish
201+
jreleaserUpload.dependsOn publish
202+
jreleaserUpload.shouldRunAfter publish
203+
164204
test {
165205
useJUnitPlatform()
166206
testLogging {

gradle/wrapper/gradle-wrapper.jar

252 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87-
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
8890

8991
# Use the maximum available, or set MAX_FD != -1 to use that value.
9092
MAX_FD=maximum
@@ -203,7 +205,7 @@ fi
203205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204206

205207
# Collect all arguments for the java command:
206-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207209
# and any embedded shellness will be escaped.
208210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209211
# treated as '${Hostname}' itself on the command line.

gradlew.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################

0 commit comments

Comments
 (0)