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,14 +44,19 @@ tasks.named('test') {
useJUnitPlatform() useJUnitPlatform()
} }
String repository_url = System.getenv("REPOSITORY_URL")
String username = System.getenv("USERNAME")
String password = System.getenv("TOKEN")
if (repository_url && username && password) {
publishing { publishing {
repositories { repositories {
maven { maven {
name = "OSSRH" name = "OSSRH"
url = uri(System.getenv("REPOSITORY_URL")) url = uri(repository_url)
credentials { credentials {
username = System.getenv("USERNAME") username = username
password = System.getenv("TOKEN") password = password
} }
} }
} }
@ -63,3 +68,5 @@ publishing {
} }
} }
} }
}