Skip to content

Commit

Permalink
Implement staging to OSSRH
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusAmshove committed Feb 14, 2021
1 parent bd85f6b commit 15a8b45
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 57 deletions.
76 changes: 49 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ allprojects {
apply plugin: 'com.adarshr.test-logger'

repositories {
jcenter()
mavenCentral()
maven { url "http://kotlin.bintray.com/kotlinx" }
}
}

subprojects {
ext.configurePublishing = { artifactName = null ->
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'signing'

signing {
useGpgCmd()
sign configurations.archives
}

artifactName = artifactName ?: project.name

Expand All @@ -62,33 +67,52 @@ subprojects {
from sourceSets.main.allSource
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

artifacts {
archives sourcesJar
archives javadocJar, sourcesJar
}

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
publish = true
override = true
publications = ['Publication']
configurations = ['archives']
pkg {
repo = 'maven'
name = artifactName
licenses = ['MIT']
vcsUrl = 'https://github.com/MarkusAmshove/Kluent'
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

publishing {
publications {
Publication(MavenPublication) {
from components.java
groupId 'org.amshove.kluent'
artifactId artifactName
version project.version
artifact sourcesJar
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name artifactName
packaging 'jar'
description 'Fluent Assertion-Library for Kotlin'
url 'https://github.com/MarkusAmshove/Kluent'

scm {
connection 'scm:git:git:github.com/MarkusAmshove/Kluent.git'
developerConnection 'scm:git:git:github.com/MarkusAmshove/Kluent.git'
url 'https://github.com/MarkusAmshove/Kluent'
}

licenses {
license {
name 'MIT'
url 'https://github.com/MarkusAmshove/Kluent/blob/master/LICENSE'
}
}

developers {
developer {
id 'markusamshove'
name 'Markus Amshove'
}
}
}
}
}
Expand All @@ -99,7 +123,5 @@ subprojects {
logger.info("artifactName: $artifactName")
}
}

bintrayUpload.dependsOn(printArtifactName)
}
}
5 changes: 0 additions & 5 deletions jvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ dependencies {
implementation libs.kotlin_stdlib_jvm
implementation libs.kotlin_reflect
implementation libs.kotlin_test_jvm
if(isAndroid) {
runtime libs.kotlin_stdlib_jvm
runtime libs.kotlin_reflect
runtime libs.kotlin_test_jvm
}
implementation libs.junit

testImplementation libs.junit
Expand Down
26 changes: 1 addition & 25 deletions publishAll.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
#!/bin/bash

if [[ $# -ne 2 ]]; then
echo Missing parameters. Use "publishAll.sh BINTRAY_USER BINTRAY_KEY" >&2
exit 2
fi

BINTRAY_USER="$1"
BINTRAY_KEY="$2"

function publish {
name=$1
flags=$2

if ./gradlew clean build $flags -PbintrayUser="$BINTRAY_USER" -PbintrayKey="$BINTRAY_KEY"; then
echo "Published $name"
else
echo
echo "Failed to publish $name" >&2
exit 1
fi
}

publish "Common" "kluent-common:bintrayUpload"
publish "JVM" "kluent:bintrayUpload"
publish "Android" "kluent-android:bintrayUpload -PANDROID"
publish "JavaScript" "kluent-js:bintrayUpload -PJS -PSKIPJVM"
echo Staging: ./gradlew clean uploadArchives [-PANDROID] [-PJS]

0 comments on commit 15a8b45

Please sign in to comment.