diff --git a/build.gradle.kts b/build.gradle.kts index 4fee9124..9a146ee3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -81,31 +81,32 @@ publishing { maven { name = "FoxikleCytonicRepository" url = uri("https://repo.foxikle.dev/cytonic") - credentials(PasswordCredentials::class) +// credentials(PasswordCredentials::class) + // Use providers to get the properties or fallback to environment variables + var u = System.getenv("REPO_USERNAME") + var p = System.getenv("REPO_PASSWORD") + + if (u == null || u.isEmpty()) { + u = "no-value-provided" + } + if (p == null || p.isEmpty()) { + p = "no-value-provided" + } + + println("pass: $p | user: $u") + + + val user = providers.gradleProperty("usernames").orElse(u).get() + val pass = providers.gradleProperty("passwords").orElse(p).get() + println("pass: $pass | user: $user") + println("pass: ${pass.length} | user: ${user.length}") + credentials { + username = user.toString() + password = pass.toString() + } authentication { create("basic") { - // Use providers to get the properties or fallback to environment variables - var u = System.getenv("REPO_USERNAME") - var p = System.getenv("REPO_PASSWORD") - - if (u == null || u.isEmpty()) { - u = "no-value-provided" - } - if (p == null || p.isEmpty()) { - p = "no-value-provided" - } - - println("pass: $p | user: $u") - - - val user = providers.gradleProperty("username").orElse(u).get() - val pass = providers.gradleProperty("password").orElse(p).get() - println("pass: $pass | user: $user") - println("pass: ${pass.length} | user: ${user.length}") - credentials { - username = user - password = pass - } + } } }