Skip to content

Commit

Permalink
publish.gradle.kts: GitHubPackages task added
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmiles committed Dec 15, 2023
1 parent e160e8e commit bdf8e9c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ allprojects {
// Default is Maven buildDirectory publish only
url = uri(layout.buildDirectory.dir("repo"))
}



if(findProperty("doGitHubPackagesPublish") == "true") {
val GITHUB_ACTOR = System.getenv("GITHUB_USERNAME") ?: System.getenv("GITHUB_ACTOR") ?: throw IllegalArgumentException()
val GITHUB_TOKEN = System.getenv("GITHUB_TOKEN") ?: System.getenv("GH_TOKEN") ?: throw IllegalArgumentException()
val GITHUB_REPOSITORY = System.getenv("GITHUB_REPOSITORY")

assert(GITHUB_ACTOR.isNotEmpty() == true)
assert(GITHUB_TOKEN.isNotEmpty() == true)
assert(GITHUB_REPOSITORY.isNotEmpty() == true)

maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${GITHUB_REPOSITORY}")
credentials {
username = GITHUB_ACTOR
password = GITHUB_TOKEN
}
}
}
}
}
}

0 comments on commit bdf8e9c

Please sign in to comment.