diff --git a/build.gradle b/build.gradle index 3025ee9f..a8f0819b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'com.diffplug.spotless' version '6.25.0' apply false id 'org.kordamp.gradle.jandex' version '2.1.0' apply false - id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' + id 'org.jreleaser' version '1.19.0' id 'net.researchgate.release' version '3.1.0' } @@ -10,27 +10,17 @@ wrapper { } String groupId = 'org.gitlab4j' +group = groupId +def repositoryPath = 'build/staging-deploy' subprojects { apply plugin: 'java-library' - apply plugin: 'signing' apply plugin: 'com.diffplug.spotless' apply plugin: 'maven-publish' apply plugin: 'org.kordamp.gradle.jandex' group = groupId - signing { - useGpgCmd() - sign(publishing.publications) - } - - tasks.withType(Sign) { - onlyIf { - project.hasProperty('signing.gnupg.keyName') - } - } - java { withJavadocJar() withSourcesJar() @@ -61,21 +51,74 @@ subprojects { tasks.named("javadoc") { inputs.files(tasks.getByPath("jandex").outputs.files) } + + publishing { + repositories { + maven { + url = rootProject.file(repositoryPath) + } + } + } } -nexusPublishing { - packageGroup = 'org.gitlab4j' - repositories { - sonatype { - nexusUrl.set(uri("https://oss.sonatype.org/service/local/")) - username = project.findProperty('ossSonatypeUsername') ?: '' - password = project.findProperty('ossSonatypePassword') ?: '' +jreleaser { + signing { + active = 'RELEASE' + armored = true + } + deploy { + maven { + mavenCentral { + gitlab4j { + active = 'RELEASE' + namespace = 'org.gitlab4j' + url = 'https://central.sonatype.com/api/v1/publisher' + stagingRepository(repositoryPath) + retryDelay = 30 + maxRetries = 150 + } + } + } + } + release { + github { + enabled = true + repoOwner = "$githubRepositoryOwner" + name = "$githubRepositoryName" + tagName = '{{projectVersion}}' + overwrite = true + skipTag = true + releaseNotes { + enabled = true + } + changelog { + enabled = false + } + milestone { + close = true + } + issues { + enabled = true + comment = 'This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))' + applyMilestone = 'ALWAYS' + + label { + name = 'released' + color = '#FF0000' + description = 'Issue has been released' + } + } } } } release { - buildTasks = ['doRelease'] + buildTasks = [ + 'checkLastVersionValue', + 'clean', + 'publish', + 'jreleaserDeploy' + ] git { requireBranch.set('main') } @@ -107,25 +150,8 @@ def updateLastVersionValueTask = tasks.register('updateLastVersionValue') { } } -task doRelease { - dependsOn( - checkLastVersionValueTask, - 'initializeSonatypeStagingRepository', - 'clean', - 'build' - ) -} - model { tasks.unSnapshotVersion { dependsOn updateLastVersionValueTask } } -// dependency on 'publishToSonatype' must be added in a 'afterEvaluate' block, see https://github.com/gradle/gradle/issues/16543#issuecomment-2529428010 -afterEvaluate { - model { - tasks.doRelease { - dependsOn project.getTasksByName('publishToSonatype', true) - } - } -} diff --git a/gitlab4j-api/build.gradle b/gitlab4j-api/build.gradle index 4649d245..c52ba5c4 100644 --- a/gitlab4j-api/build.gradle +++ b/gitlab4j-api/build.gradle @@ -42,6 +42,7 @@ publishing { email = 'gautier@jabby-techs.fr' } developer { + id = "$githubRepositoryOwner" url = 'https://github.com/orgs/' + "$githubRepositoryOwner" + '/people' } } diff --git a/gitlab4j-models/build.gradle b/gitlab4j-models/build.gradle index f888cbcf..57bc20d2 100644 --- a/gitlab4j-models/build.gradle +++ b/gitlab4j-models/build.gradle @@ -36,6 +36,7 @@ publishing { email = 'gautier@jabby-techs.fr' } developer { + id = "$githubRepositoryOwner" url = 'https://github.com/orgs/' + "$githubRepositoryOwner" + '/people' } }