Skip to content

Commit

Permalink
Use the Provider API to load GitHub Packages credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Mar 15, 2024
1 parent 03aeb0f commit 3493c24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ class PillarboxAndroidLibraryPublishingPlugin : Plugin<Project> {
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()
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3493c24

Please sign in to comment.