Skip to content

[#704] Release snapshots using gradle-nexus.publish-plugin #706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ jobs:
ORG_GRADLE_PROJECT_jbossNexusUser: ${{ secrets.JBOSS_NEXUS_USER }}
ORG_GRADLE_PROJECT_jbossNexusPassword: ${{ secrets.JBOSS_NEXUS_PASSWORD }}
if: endsWith( steps.detect-version.outputs.version, '-SNAPSHOT' ) && env.ORG_GRADLE_PROJECT_jbossNexusUser
run: ./gradlew publish
run: ./gradlew publishToJBossNexus closeAndReleaseJBossNexusStagingRepository

release:
name: Release
Expand Down
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ plugins {
}

ext {
// Credentials can be specified on the command-line using project properties,
// or stored locally using the gradle-credentials-plugin.
// See below for the name of project properties.
// See https://github.com/etiennestuder/gradle-credentials-plugin to store credentials locally.
if (!project.hasProperty('jbossNexusUser')) {
jbossNexusUser = credentials.jbossNexusUser
}
if (!project.hasProperty('jbossNexusPassword')) {
jbossNexusPassword = credentials.jbossNexusPassword
}
if (!project.hasProperty('sonatypeOssrhUser')) {
sonatypeOssrhUser = credentials.sonatypeOssrhUser
}
Expand Down Expand Up @@ -79,12 +89,24 @@ ext {
logger.lifecycle "Hibernate Reactive: " + project.version
}

// To release, see task ciRelease in release/build.gradle

// To publish snapshots:
// ./gradlew publishToJBossNexus closeAndReleaseJBossNexusStagingRepository -PjbossNexusUser="<YOUR USERNAME>" -PjbossNexusPassword="<YOUR PASSWORD>"

// To publish on Sonatype (Maven Central):
// ./gradlew publishToSonatype closeAndReleaseStagingRepository -PsonatypeOssrhUser="<YOUR USERNAME>" -PsonatypeOssrhPassword="<YOUR PASSWORD>"
nexusPublishing {
repositories {
sonatype {
username = project.sonatypeOssrhUser
password = project.sonatypeOssrhPassword
}
jBossNexus {
snapshotRepositoryUrl = uri('https://repository.jboss.org/nexus/content/repositories/snapshots')
username = project.jbossNexusUser
password = project.jbossNexusPassword
}
}
}

Expand Down
30 changes: 0 additions & 30 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
apply plugin: 'maven-publish'
apply plugin: 'nu.studer.credentials'

// To publish snapshots:
// ./gradlew publish -PjbossNexusUser="<YOUR USERNAME>" -PjbossNexusPassword="<YOUR PASSWORD>"
// To release, see task ciRelease in release/build.gradle
// To publish on Sonatype (Maven Central):
// ./gradlew publishToSonatype closeAndReleaseStagingRepository -PsonatypeOssrhUser="<YOUR USERNAME>" -PsonatypeOssrhPassword="<YOUR PASSWORD>"

ext {
// Credentials can be specified on the command-line using project properties,
// or stored locally using the gradle-credentials-plugin.
// See below for the name of project properties.
// See https://github.com/etiennestuder/gradle-credentials-plugin to store credentials locally.
if (!project.hasProperty('jbossNexusUser')) {
jbossNexusUser = credentials.jbossNexusUser
}
if (!project.hasProperty('jbossNexusPassword')) {
jbossNexusPassword = credentials.jbossNexusPassword
}
}

task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
Expand Down Expand Up @@ -54,17 +35,6 @@ javadoc {
}

publishing {
repositories {
// mavenLocal()
maven {
name 'jboss-snapshots-repository'
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
credentials {
username project.jbossNexusUser
password project.jbossNexusPassword
}
}
}
publications {
logger.lifecycle "Publishing groupId: '" + project.group + "', version: '" + project.version + "'"

Expand Down
2 changes: 1 addition & 1 deletion release/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ gitPublish {
}

// message used when committing changes
commitMessage = "Hibernate Reactive documentation for ${projectVersion}"
commitMessage = "[HREACTIVE] Hibernate Reactive documentation for ${projectVersion}"
}

gitPublishCopy.dependsOn assembleDocumentation
Expand Down