diff --git a/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt b/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt index a17245104..417378e3a 100644 --- a/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt +++ b/build-logic/plugins/src/main/java/ch/srgssr/pillarbox/gradle/PillarboxAndroidLibraryPublishingPlugin.kt @@ -49,9 +49,14 @@ class PillarboxAndroidLibraryPublishingPlugin : Plugin { maven { name = "GitHubPackages" url = uri("https://maven.pkg.github.com/SRGSSR/pillarbox-android") + credentials { - username = findProperty("gpr.user") as String? ?: System.getenv("USERNAME") - password = findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") + username = providers.gradleProperty("gpr.user") + .orElse(providers.environmentVariable("USERNAME")) + .get() + password = providers.gradleProperty("gpr.key") + .orElse(providers.environmentVariable("GITHUB_TOKEN")) + .get() } } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 622b0ab93..9cf4026ef 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,8 +16,12 @@ pluginManagement { dependencyResolutionManagement { repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS repositories { - val gitHubUsername = providers.gradleProperty("gpr.user").getOrElse(System.getenv("USERNAME")) - val gitHubKey = providers.gradleProperty("gpr.key").getOrElse(System.getenv("GITHUB_TOKEN")) + val gitHubUsername = providers.gradleProperty("gpr.user") + .orElse(providers.environmentVariable("USERNAME")) + .get() + val gitHubKey = providers.gradleProperty("gpr.key") + .orElse(providers.environmentVariable("GITHUB_TOKEN")) + .get() google() mavenCentral()