Skip to content

Commit

Permalink
3.x: Release to Sonatype directly (#7181)
Browse files Browse the repository at this point in the history
* 3.x: Release to Sonatype directly

* Update build.gradle

* Update gradle.properties

* Turn RS into compile dependency in POM

* Fix the POM of the snapshot/artifactory upload
  • Loading branch information
akarnokd authored Feb 5, 2021
1 parent 0cb8978 commit 5fb0ace
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 122 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/gradle_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
env:
# Define secrets at https://github.com/ReactiveX/RxJava/settings/secrets/actions
# ------------------------------------------------------------------------------
bintrayUser: ${{ secrets.BINTRAY_USER }}
bintrayKey: ${{ secrets.BINTRAY_KEY }}
sonatypeUsername: ${{ secrets.SONATYPE_USER }}
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
JAVADOCS_TOKEN: ${{ secrets.JAVADOCS_TOKEN }}
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
# ------------------------------------------------------------------------------
CI_BUILD_NUMBER: ${{ github.run_number }}
steps:
Expand All @@ -43,8 +43,12 @@ jobs:
- name: Extract version tag
run: echo "BUILD_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Build and Release
run: ./gradlew -PreleaseMode=full -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build --stacktrace
run: ./gradlew -PreleaseMode=full build --stacktrace --no-daemon
- name: Upload to Codecov
uses: codecov/codecov-action@v1
- name: Upload release
run: ./gradlew -PreleaseMode=full javadocCleanup uploadArchives --no-daemon --no-parallel
- name: Publish release
run: ./gradlew -PreleaseMode=full closeAndReleaseRepository --no-daemon --no-parallel
- name: Push Javadocs
run: ./push_javadoc.sh
149 changes: 34 additions & 115 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ buildscript {
ext.jacocoVersion = "0.8.4"
ext.animalSnifferVersion = "1.5.2"
ext.licenseVersion = "0.15.0"
ext.bintrayVersion = "1.8.5"
ext.jfrogExtractorVersion = "4.20.0"
ext.bndVersion = "5.2.0"
ext.checkstyleVersion = "8.26"
ext.vanniktechPublishPlugin = "0.13.0"

// --------------------------------------

repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
Expand All @@ -31,28 +30,27 @@ buildscript {
classpath "ru.vyarus:gradle-animalsniffer-plugin:$animalSnifferVersion"
classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:$licenseVersion"
classpath "me.champeau.gradle:jmh-gradle-plugin:$jmhGradleVersion"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayVersion"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$jfrogExtractorVersion"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:$bndVersion"
classpath "com.vanniktech:gradle-maven-publish-plugin:$vanniktechPublishPlugin"
}
}

group = "io.reactivex.rxjava3"
ext.githubProjectName = "rxjava"

version = project.properties["release.version"]

def releaseTag = System.getenv("BUILD_TAG");
if (releaseTag != null && !releaseTag.isEmpty()) {
if (releaseTag.startsWith("v")) {
releaseTag = releaseTag.substring(1);
}
version = releaseTag;
project.properties.put("release.version", releaseTag);
project.setProperty("VERSION_NAME" , releaseTag);

println("Releasing with version " + version);
}

version = project.properties["VERSION_NAME"]

description = "RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM."

apply plugin: "java-library"
Expand All @@ -62,7 +60,6 @@ apply plugin: "ru.vyarus.animalsniffer"
apply plugin: "maven"
apply plugin: "me.champeau.gradle.jmh"
apply plugin: "com.github.hierynomus.license"
apply plugin: "com.jfrog.bintray"
apply plugin: "com.jfrog.artifactory"
apply plugin: "eclipse"

Expand Down Expand Up @@ -116,21 +113,7 @@ animalsniffer {
annotation = "io.reactivex.rxjava3.internal.util.SuppressAnimalSniffer"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}

artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
apply plugin: 'maven'

apply plugin: 'biz.aQute.bnd.builder'

Expand All @@ -154,61 +137,6 @@ license {
excludes(["**/*.md", "**/*.txt"])
}

apply plugin: "maven-publish"

install {
repositories.mavenInstaller.pom.project {
name "RxJava"
description "Reactive Extensions for Java"
url "https://github.com/ReactiveX/RxJava"
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id "akarnokd"
name "David Karnok"
email "[email protected]"
}
}
scm {
connection "scm:git:[email protected]:ReactiveX/RxJava.git"
url "scm:git:[email protected]:ReactiveX/RxJava.git"
developerConnection "scm:git:[email protected]:ReactiveX/RxJava.git"
}
issueManagement {
system "github"
url "https://github.com/ReactiveX/RxJava/issues"
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact (sourcesJar) {
classifier = "sources"
}
}
}
}

// Reactive-Streams as compile dependency
publishing.publications.all {
pom.withXml {
asNode().dependencies."*".findAll() {
it.scope.text() == "runtime" && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each { it.scope*.value = "compile"}
}
}

jmh {
jmhVersion = jmhLibVersion
humanOutputFile = null
Expand Down Expand Up @@ -312,12 +240,28 @@ checkstyle {
toolVersion = checkstyleVersion
}

apply from: file("gradle/javadoc_cleanup.gradle")

def fixPom() {
// Reactive-Streams as compile dependency
publishing.publications.all {
pom.withXml {
asNode().dependencies."*".findAll() {
it.scope.text() == "runtime" && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each { it.scope*.value = "compile"}
}
}
}

if (rootProject.hasProperty("releaseMode")) {

if ("branch".equals(rootProject.releaseMode)) {
// From https://github.com/ReactiveX/RxAndroid/blob/2.x/rxandroid/build.gradle#L94

println("ReleaseMode: " + rootProject.releaseMode);

artifactory {
contextUrl = "https://oss.jfrog.org"

Expand All @@ -332,48 +276,23 @@ if (rootProject.hasProperty("releaseMode")) {
defaults {
publishConfigs("archives")
}

fixPom()
}
}

build.finalizedBy(artifactoryPublish)
}

if ("full".equals(rootProject.releaseMode)) {
// based on https://github.com/bintray/gradle-bintray-plugin
def rver = version;

println("ReleaseMode: " + rootProject.releaseMode + " version " + rver);

bintray {
user = rootProject.bintrayUser
key = rootProject.bintrayKey
configurations = ["archives"]
publish = true
override = true // Allows re-running the GHA upon release hangs
pkg {
repo = "RxJava"
name = "RxJava"
userOrg = "reactivex"
labels = ["rxjava", "reactivex"]
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/ReactiveX/RxJava.git"
version {
name = rver
gpg {
sign = true
}
mavenCentralSync {
sync = true
user = rootProject.sonatypeUsername
password = rootProject.sonatypePassword
close = "1"
}
}
}
if ("full".equals(rootProject.releaseMode)) {
apply plugin: "com.vanniktech.maven.publish"

fixPom()

signing {
if (project.hasProperty('SIGNING_PRIVATE_KEY') && project.hasProperty('SIGNING_PASSWORD')) {
useInMemoryPgpKeys(project.getProperty('SIGNING_PRIVATE_KEY'), project.getProperty('SIGNING_PASSWORD'))
}

build.finalizedBy(bintrayUpload)
}
}
}
}

apply from: file("gradle/javadoc_cleanup.gradle")
24 changes: 23 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
release.scope=patch
release.version=3.0.0-SNAPSHOT
VERSION_NAME=3.0.0-SNAPSHOT

GROUP=io.reactivex.rxjava3
POM_ARTIFACT_ID=rxjava
POM_NAME=RxJava
POM_PACKAGING=jar

POM_DESCRIPTION=Reactive Extensions for Java
POM_INCEPTION_YEAR=2013

POM_URL=https://github.com/akarnokd/RxJavaExtensions
POM_SCM_URL=https://github.com/ReactiveX/RxJava
POM_SCM_CONNECTION=scm:git:git://github.com/ReactiveX/RxJava.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/ReactiveX/RxJava.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=akarnokd
POM_DEVELOPER_NAME=David Karnok
POM_DEVELOPER_URL=https://github.com/akarnokd/
POM_DEVELOPER_EMAIL[email protected]
1 change: 0 additions & 1 deletion gradle/javadoc_cleanup.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ def fixJavadocFile(file) {
file.setText(fileContents, 'UTF-8');
}

javadocJar.dependsOn javadocCleanup
build.dependsOn javadocCleanup

0 comments on commit 5fb0ace

Please sign in to comment.