Skip to content

Instantly share code, notes, and snippets.

@olafurpg
Created August 14, 2020 09:34
Embed
What would you like to do?
import sbt._
import sbt.Keys._
import sbt.plugins._
object ArtifactoryPlugin extends AutoPlugin {
override def trigger = allRequirements
override def requires = JvmPlugin && IvyPlugin
override val buildSettings = List(
commands += Command.command("publishArtifactory") { s =>
val newVersion = Project
.extract(s)
.get(version.in(ThisBuild))
.stripSuffix("-SNAPSHOT")
"""set every publishTo := Some("artifactory" at "https://artifactory.twitter.biz/libs-releases-local/")""" ::
s"""set every version := "$newVersion" """ ::
"publish" ::
s
}
)
override val projectSettings = List(
credentials ++= {
val credentials = file(System.getProperty("user.home")) / ".artifactory" / ".credentials"
if (credentials.isFile) List(new FileCredentials(credentials))
else Nil
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment