use gha packages

This commit is contained in:
Mark Canlas 2023-01-02 15:58:16 -05:00
parent 4619439e2c
commit 1a4c2b89da
3 changed files with 40 additions and 9 deletions

View File

@ -15,3 +15,5 @@ jobs:
cache: sbt
- run: sbt 'scalafixAll --check' scalafmtCheck +test
env:
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}

View File

@ -18,12 +18,5 @@ lazy val demo =
.dependsOn(core)
.withEfectMonad
.settings(libraryDependencies += "com.htmlism" %% "rufio-zio" % "76-c565ab28")
ThisBuild / resolvers += "mcanlas/rufio" at "https://maven.pkg.github.com/mcanlas/rufio/"
ThisBuild / credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"mcanlas",
sys.env("GH_PACKAGES_TOKEN")
)
.withGitHubPackagesCredentials
.withResolver("rufio")

View File

@ -0,0 +1,36 @@
import sbt._
import sbt.Keys._
/**
* Automatically enriches projects with the following settings (despite the word "override").
*/
object GitHubPackages extends AutoPlugin {
/**
* Thus plug-in will automatically be enabled; it has no requirements.
*/
override def trigger: PluginTrigger = AllRequirements
val autoImport = ThingsToAutoImport
object ThingsToAutoImport {
implicit class PackagesOps(p: Project) {
def withGitHubPackagesCredentials: Project =
p
.settings(
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"mcanlas",
sys.env("GH_PACKAGES_TOKEN")
)
)
def withResolver(project: String): Project =
p
.settings(
resolvers += s"mcanlas/$project" at s"https://maven.pkg.github.com/mcanlas/$project/"
)
}
}
}