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