From 0e9a2b12eb81128b009e8673d3a986a96c0717b0 Mon Sep 17 00:00:00 2001 From: foxikle Date: Fri, 14 Jun 2024 13:17:14 -0400 Subject: [PATCH] new idea --- build.gradle.kts | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) 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 - } + } } }