diff --git a/README.md b/README.md index 19b3dd1..132f70f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,16 @@ You may also *optionally* specify a repository as the second argument. **This is This resolver will give you access to packages published on *any* repository within the organization. If the token provided in the authentication information only has access to public repositories, then packages published on private repositories will report "not found". If the token has access to private repositories as well as public, then all packages will be visible. -You will need to ensure that `githubTokenSource` is set to *your* details (i.e. the authentication information for the individual who ran `sbt`). The `TokenSource` ADT has the following possibilities: +### Authentication + +You will need to ensure that `githubTokenSource` is set to *your* details (i.e. the authentication information for the individual who ran `sbt`). If you do +not establish a token source then you will be unable to authenticate, and you will receive the following message when you attempt to publish: + +``` +[error] Unable to find credentials for [GitHub Package Registry @ maven.pkg.github.com]. +``` + +The `TokenSource` ADT has the following possibilities: ```scala sealed trait TokenSource extends Product with Serializable { diff --git a/build.sbt b/build.sbt index 1364f50..b6f7d10 100644 --- a/build.sbt +++ b/build.sbt @@ -16,7 +16,7 @@ name := "sbt-github-packages" -ThisBuild / baseVersion := "0.5" +ThisBuild / baseVersion := "0.6" ThisBuild / organization := "com.codecommit" ThisBuild / publishGithubUser := "djspiewak" @@ -27,12 +27,21 @@ ThisBuild / sbtVersion := "1.3.3" enablePlugins(SbtPlugin) -homepage := Some(url("https://github.com/djspiewak/sbt-github-packages")) +githubOwner := "openlawteam" +githubRepository := "sbt-github-packages" +githubTokenSource := TokenSource.GitConfig("github.token") || TokenSource + .Environment("GITHUB_TOKEN") + +publishTo := Some( + "GitHub Packages Propeller Scala" at "https://maven.pkg.github.com/openlawteam/sbt-github-packages" +) + +homepage := Some(url("https://github.com/openlawteam/sbt-github-packages")) scmInfo := Some( ScmInfo( - url("https://github.com/djspiewak/sbt-github-packages"), - "scm:git@github.com:djspiewak/sbt-github-packages.git")) + url("https://github.com/openlawteam/sbt-github-packages"), + "scm:git@github.com:openlawteam/sbt-github-packages.git")) developers := List( Developer(id="djspiewak", name="Daniel Spiewak", email="djspiewak@gmail.com", url=url("https://github.com/djspiewak"))) diff --git a/project/plugins.sbt b/project/plugins.sbt index bd41d01..bc5cdfd 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,2 @@ addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.9.1") +addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3") \ No newline at end of file diff --git a/src/main/scala/sbtghpackages/GitHubPackagesPlugin.scala b/src/main/scala/sbtghpackages/GitHubPackagesPlugin.scala index ad2fdc7..4dc03ad 100644 --- a/src/main/scala/sbtghpackages/GitHubPackagesPlugin.scala +++ b/src/main/scala/sbtghpackages/GitHubPackagesPlugin.scala @@ -43,14 +43,14 @@ object GitHubPackagesPlugin extends AutoPlugin { val authenticationSettings = Seq( githubTokenSource := TokenSource.Environment("GITHUB_TOKEN"), - credentials += { + credentials ++= { val src = githubTokenSource.value inferredGitHubCredentials("_", src) match { // user is ignored by GitHub, so just use "_" case Some(creds) => - creds + Seq(creds) case None => - sys.error(s"unable to locate a valid GitHub token from $src") + Seq.empty } })