Only fetch publishing information when relevant envvars are set

This commit is contained in:
Justin Abrahms 2022-04-28 14:37:54 -07:00
parent a65cfc801b
commit f043020b45
1 changed files with 22 additions and 15 deletions

View File

@ -44,22 +44,29 @@ tasks.named('test') {
useJUnitPlatform() useJUnitPlatform()
} }
publishing { String repository_url = System.getenv("REPOSITORY_URL")
repositories { String username = System.getenv("USERNAME")
maven { String password = System.getenv("TOKEN")
name = "OSSRH" if (repository_url && username && password) {
url = uri(System.getenv("REPOSITORY_URL"))
credentials { publishing {
username = System.getenv("USERNAME") repositories {
password = System.getenv("TOKEN") maven {
name = "OSSRH"
url = uri(repository_url)
credentials {
username = username
password = password
}
}
}
publications {
gpr(MavenPublication) {
artifactId = 'javasdk'
version = '0.0.1' + (Boolean.valueOf(System.getProperty("snapshot")) ? "-SNAPSHOT" : "")
from(components.java)
} }
} }
} }
publications {
gpr(MavenPublication) {
artifactId = 'javasdk'
version = '0.0.1' + (Boolean.valueOf(System.getProperty("snapshot")) ? "-SNAPSHOT" : "")
from(components.java)
}
}
} }