Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ jobs:
- name: Publish Artifacts
uses: ./actions/run-gradle
with:
gradle_command: publish closeAndReleaseStagingRepositories -PreleaseBuild=true -PpublishBuild=true -PgithubPublish=true -PcentralPublish=true
gradle_command: publish jreleaserDeploy -PreleaseBuild=true -PpublishBuild=true -PgithubPublish=true -PcentralPublish=true
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Post release: Update various files which reference version
Expand Down
59 changes: 40 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
* limitations under the License.
*/

import org.yaml.snakeyaml.Yaml

import org.apache.tools.ant.taskdefs.condition.Os
import org.yaml.snakeyaml.Yaml

buildscript {
repositories {
Expand All @@ -41,7 +40,7 @@ plugins {
alias(libs.plugins.protobuf)
alias(libs.plugins.versions)
alias(libs.plugins.spotbugs)
alias(libs.plugins.nexus)
alias(libs.plugins.jreleaser)
alias(libs.plugins.download)
}

Expand All @@ -60,7 +59,6 @@ allprojects {
apply plugin: 'base'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'project-reports'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'de.undercouch.download'
Expand Down Expand Up @@ -165,14 +163,6 @@ allprojects {
dependsOn tasks.jar, tasks.package
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
}

repositories {
if (System.getenv("ARTIFACT_VERSION") != null) {
version = "${System.getenv('ARTIFACT_VERSION')}"
Expand Down Expand Up @@ -310,16 +300,47 @@ subprojects {
// Configure publishing for maven central. This is done in the top-level build.gradle, and then
// all of the subprojects configure the artifacts they want published by applying
// ${rootDir}/gradle/publishing.gradle in the project gradle. By default, we publish a library
// from each package, but this can be configured by adjusting the publishLibrary variable
if (Boolean.parseBoolean(centralPublish)) {
nexusPublishing {
repositories {
sonatype {
// Update the URL now that the OSSRH service has been sunset: https://central.sonatype.org/news/20250326_ossrh_sunset/
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
// from each package, but this can be configured by adjusting the publishLibrary variable.
// Each subproject will place its artifacts into the central staging repository,
// which will then be picked up by the release configuration
if (Boolean.parseBoolean(publishBuild) && Boolean.parseBoolean(centralPublish)) {
var stagingRepo = layout.buildDirectory.dir('staging-repo')

jreleaser {
project {
authors = ['FoundationDB']
license = 'The Apache License, Version 2.0'
licenseUrl = 'https://www.apache.org/licenses/LICENSE-2.0'
links {
homepage = 'https://foundationdb.github.io/fdb-record-layer/'
}
inceptionYear = '2015'
}

signing {
active = 'ALWAYS'
armored = true
}

deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
applyMavenCentralRules = true
stage = 'FULL'

stagingRepository(stagingRepo.get().asFile.path)
}
}
}
}

dependsOnAssemble = true
}

tasks.jreleaserDeploy.inputs.dir(stagingRepo)
}

// Script for upgrading gradle. To upgrade the gradle version, set the property to the version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,3 @@ publishing {

}
}

if (Boolean.parseBoolean(centralPublish)) {
signing {
sign publishing.publications.shadow
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ test-compileOnly = [ "autoService", "jsr305" ]
download = { id = "de.undercouch.download", version = "5.6.0" }
gitversion = { id = "com.palantir.git-version", version = "3.1.0" }
jmh = { id = "me.champeau.jmh", version = "0.7.2" }
nexus = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
jreleaser = { id = "org.jreleaser", version = "1.21.0" }
protobuf = { id = "com.google.protobuf", version = "0.9.4" }
serviceloader = { id = "com.github.harbby.gradle.serviceloader", version = "1.1.8" }
shadow = { id = "com.gradleup.shadow", version = "8.3.5" }
Expand Down
21 changes: 14 additions & 7 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* limitations under the License.
*/

apply plugin: 'signing'

// Add various details to the pom file to allow for publishing
def addPublishingInfo(publication) {
publication.pom {
Expand Down Expand Up @@ -88,11 +86,6 @@ if (ext.publishLibrary) {
}
}
}
if (Boolean.parseBoolean(centralPublish)) {
signing {
sign publishing.publications.library
}
}
}

ext {
Expand All @@ -102,7 +95,21 @@ ext {

publishing {
if (Boolean.parseBoolean(publishBuild)) {

repositories {
if (Boolean.parseBoolean(centralPublish)) {
// For JReleaser to deploy artifacts, they must have been staged to the local staging repo.
// Mark that directory as an output and declare a dependency between publishing the
// project and deploying artifacts.
var stagingDir = rootProject.layout.buildDirectory.dir('staging-repo')
tasks.publish.outputs.dir(stagingDir)
rootProject.tasks.findByName('jreleaserDeploy').dependsOn(tasks.publish)

maven {
url = stagingDir
}
}

if (Boolean.parseBoolean(githubPublish)) {
maven {
name = "GitHubPackages"
Expand Down
Loading