Skip to content

Commit

Permalink
chore: credetials hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
dieppa committed Nov 26, 2024
1 parent b50dd10 commit dc9a9a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ subprojects {
apply(plugin = "java-library")

if (project.isReleasable()) {
if(!project.alreadyReleased()) {
if(!project.isAlreadyReleased()) {

println("$group:$name:$version PUBLISHING")

Expand Down Expand Up @@ -270,15 +270,15 @@ fun Project.isReleasable() = projectsToRelease.contains(name)
val encodedCredentials: String = Base64.getEncoder()
.encodeToString("${System.getenv("JRELEASER_MAVENCENTRAL_USERNAME")}:${System.getenv("JRELEASER_MAVENCENTRAL_PASSWORD")}".toByteArray())

fun Project.alreadyReleased() : Boolean {
fun Project.isAlreadyReleased() : Boolean {
val url = "https://central.sonatype.com/api/v1/publisher/published?namespace=${group}&name=$name&version=$version"
logger.lifecycle("Checking if published from: $url")
logger.lifecycle("Using credentials: $encodedCredentials")

val request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("accept", "application/json")
.header("Authorization", "Basic $encodedCredentials")
.header("Authorization", "Basic bmllTVZMREs6clJXZkRyVHEycFZ1K2t2Vk1EUUJOanl6RC9YTmpOS1ZObEo5ZlRFZ3UvUWM=")
.GET()
.build()

Expand All @@ -295,6 +295,6 @@ fun Project.alreadyReleased() : Boolean {
} else {
//TODO implement retry
logger.lifecycle("Error checking if artefact already published[${response.statusCode()}]: ${response.body()}")
false
true
}
}

0 comments on commit dc9a9a5

Please sign in to comment.