Publishing to GH Packages from sbt
Briefly

Create a Repository in Github This repository will be the host for the maven registry. It can be under your user or an organization that you have enough permissions. Create a Personal Access Token With read and write access to the repository you just created in the Github GUI. Configure that access token in an environment variable of the system that will run sbt. This is in your local machine or a a Secret in a Git Hub action that feeds an environment variable.
Your github user name: <user> The name of the Token Environment variable: <TOKEN_VAR> The name of the repository to host the packages, with two parts: The user or organization that owns the repository <org> and the repository's <name> You will need: Note that the values of ghRepoName and repoHost below should NOT be changed. // build.sbtenablePlugins ( JavaAppPackaging ) val user = <user>val repo = <repo> val org = <org> val tk_var = <TOKEN_VAR>val ghRepoName = "GitHub Package Registry" val repoHost = "maven.pkg.github.com"sys.env.get(tk_var).map{ ghTk => Credentials(ghRepoName, repoHost, user, ghTk) }.match { case None => Nil case Some(cred) => credentials += cred }val packagesRepo = s"https://$repoHost/$user/$repo"publishTo := { Some(new DependencyBuilders{}).toRepositoryName(ghRepoName).at(packagesRepo)}
Read at Medium
[
add
]
[
|
|
]