Skip to content

Commit

Permalink
Change releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
gabor-boros committed Mar 4, 2020
1 parent 84899fd commit e9f76e6
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 89 deletions.
36 changes: 0 additions & 36 deletions DEPLOYING-BINTRAY.md

This file was deleted.

41 changes: 0 additions & 41 deletions DEPLOYING-SONATYPE.md

This file was deleted.

34 changes: 34 additions & 0 deletions DEPLOYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Deploying a release or snapshot to Bintray

To deploy, you'll need to create a file called `confidential.properties` in the same directory as `build.gradle.kts`
(Alternatively, you can do the same`gradle.properties` at `~/.gradle` (`%USERPROFILE%\.gradle` on Windows) with the following:

```
bintray.user=<BINTRAY_USERNAME>
bintray.key=<BINTRAY_API_KEY>
ossrhUsername=<SONATYPE_USERNAME>
ossrhPassword=<SONATYPE_PASSWORD>
signing.keyId=<SIGNING_KEY_ID>
signing.password=<SIGNING_KEY_PASSWORD>
signing.secretKeyRingFile=<SIGNING_KEY_FILE>
```

You should note that there's a `gradle.properties` in this repository, but you shouldn't add the above into it, otherwise your credentials can be checked back into git. Create the `confidential.properties` file, which is added into `.gitignore`, or create the file in the `.gradle` folder, in order to prevent accidents.

When releasing through Bintray, gpg signing is done by the person who does the release. The reason for not letting Bintray sign the packages is simply security consideration. You'll need to add your gpg signing key id and keyring file. Usually, the keyring file is located at`~/.gnupg/secring.gpg`, but Gradle won't expand home-dirs in the config file so you have to put the absolute path to your keyring file. If you don't have the private key for package signing, ask one of the **@rethinkdb/team-java** members to help you deploy.

You must use gpg 2.0 or below, since gpg 2.1 and greater doesn't use the `secring.gpg` file anymore. This is a limitation on Gradle's end and there's an [issue regarding that](https://github.com/gradle/gradle/issues/888).

To upload a new release, run `./gradlew assemble signArchives bintrayUpload`. This should upload the package to the bintray repository. the version looks like `2.2` or `2.2-SNAPSHOT`, so this is important to get right or it won't go to the right place.

## Maven Central Integration

If you are doing a release, you also need a Sonatype username and password, that you may get from [Sonatype's JIRA](https://issues.sonatype.org/secure/Signup!default.jspa), with access to the `com.rethinkdb` group. Some RethinkDB maintainer may already have it.

To upload a new release directly to Sonatype, run the Gradle task `uploadArchives`. This should sign and upload the package to the release repository. This is for official releases/betas etc. If you just want to upload a snapshot, add the suffix `-SNAPSHOT` to the `version` value in `build.gradle`. The gradle maven plugin decides which repo to upload to depending on whether the version looks like `2.2` or `2.2-SNAPSHOT`, so this is important to get right or it won't go to the right place.

After release, you may need to go to https://oss.sonatype.org/#stagingRepositories and search for "rethinkdb" in the search box, find the release that is in status `open`. Select it and then click the `Close` button. This will check it and make it ready for release. If that stage passes you can click the `Release` button.

For full instructions see: http://central.sonatype.org/pages/releasing-the-deployment.html
38 changes: 26 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import java.util.Properties
import java.io.File
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import com.jfrog.bintray.gradle.tasks.RecordingCopyTask


plugins {
Expand Down Expand Up @@ -37,15 +38,11 @@ file("confidential.properties").takeIf(File::exists)?.let {
allprojects { properties.forEach { name, value -> extra.set(name.toString(), value) } }
}

signing {
// Don't sign unless this is a release version
sign(configurations.archives.get())
}

gradle.taskGraph.whenReady {
val hasUploadArchives = hasTask(":uploadArchives")
val hasBintrayUpload = hasTask(":bintrayUpload")
val hasDoSigning = hasTask(":doSigning")
signing.isRequired = hasUploadArchives || hasDoSigning
signing.isRequired = hasBintrayUpload || hasUploadArchives || hasDoSigning
}

fun findProperty(s: String) = project.findProperty(s) as String?
Expand Down Expand Up @@ -294,7 +291,8 @@ tasks {
pom.withXml {
val root = asNode()
root.appendNode("name", "RethinkDB Java Driver")
root.appendNode("packaging", "Official java driver for RethinkDB")
root.appendNode("packaging", "Official Java driver for RethinkDB")
root.appendNode("description", "Official Java driver for RethinkDB")
root.appendNode("url", "http://rethinkdb.com")

val scm = root.appendNode("scm")
Expand Down Expand Up @@ -326,27 +324,43 @@ tasks {
}
}

signing {
// Don't sign unless this is a release version
sign(configurations.archives.get())
sign(publishing.publications.get("mavenJava"))
}

bintray {
user = findProperty("bintray.user")
key = findProperty("bintray.key")
publish = true
setPublications("mavenJava")

filesSpec(delegateClosureOf<RecordingCopyTask> {
into("com/rethinkdb/${project.name}/${project.version}/")

from("${buildDir}/libs/") {
include("*.jar.asc")
}

from("${buildDir}/publications/mavenJava/") {
include("pom-default.xml.asc")
rename("pom-default.xml.asc", "${project.name}-${project.version}.pom.asc")
}
})

pkg(delegateClosureOf<BintrayExtension.PackageConfig> {
repo = "maven"
name = project.name
userOrg = "rethinkdb"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/rethinkdb/rethinkdb-java.git"
version(delegateClosureOf<BintrayExtension.VersionConfig> {
gpg(delegateClosureOf<BintrayExtension.GpgConfig> {
sign = true
passphrase = findProperty("signing.password")
})
mavenCentralSync(delegateClosureOf<BintrayExtension.MavenCentralSyncConfig> {
user = findProperty("ossrhUsername")
password = findProperty("ossrhPassword")
sync = !user.isNullOrBlank() && !password.isNullOrBlank()
})
})
})
}
}

0 comments on commit e9f76e6

Please sign in to comment.