Create nexus staging repo in beginning of build instead of relying on auto routing. (#1854)

This commit is contained in:
Anuraag Agrawal 2020-12-09 10:11:24 +09:00 committed by GitHub
parent 49830c33a4
commit 78f1899735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 23 deletions

View File

@ -3,6 +3,7 @@ import nebula.plugin.release.git.opinion.Strategies
plugins { plugins {
id 'idea' id 'idea'
id "de.marcphilipp.nexus-publish" version "0.4.0" apply false
id "io.codearte.nexus-staging" version "0.22.0" id "io.codearte.nexus-staging" version "0.22.0"
id "nebula.release" version "15.3.0" id "nebula.release" version "15.3.0"
@ -30,10 +31,9 @@ nebulaRelease {
} }
nexusStaging { nexusStaging {
// We publish to two package groups so need to close each group individually until staging profile packageGroup = "io.opentelemetry"
// is set up. We'll run the command twice with the two groups. username = System.getenv('SONATYPE_USER')
// TODO(anuraaga): https://issues.sonatype.org/browse/OSSRH-62444 password = System.getenv('SONATYPE_KEY')
packageGroup = findProperty("mavenCentralGroup")
} }
allprojects { allprojects {

View File

@ -1,25 +1,15 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
publishing { apply plugin: 'de.marcphilipp.nexus-publish'
repositories {
maven {
if (version.toString().contains('SNAPSHOT')) {
url = "https://oss.jfrog.org/artifactory/oss-snapshot-local/"
credentials {
username = System.getenv('BINTRAY_USER')
password = System.getenv('BINTRAY_API_KEY')
}
} else {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv('SONATYPE_USER')
password = System.getenv('SONATYPE_KEY')
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}
publishing {
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
if (project.tasks.findByName("shadowJar") != null && !findProperty('noShadowPublish')) { if (project.tasks.findByName("shadowJar") != null && !findProperty('noShadowPublish')) {
@ -95,7 +85,7 @@ private String artifactPrefix(Project p, String archivesBaseName) {
return 'opentelemetry-' return 'opentelemetry-'
} }
rootProject.tasks.release.finalizedBy tasks.publish rootProject.tasks.release.finalizedBy tasks.publishToSonatype
tasks.withType(Sign).configureEach { tasks.withType(Sign).configureEach {
onlyIf { System.getenv("CI") != null } onlyIf { System.getenv("CI") != null }