Skip to content

Instantly share code, notes, and snippets.

@olafurpg
Created August 14, 2020 09:34
Show Gist options
  • Save olafurpg/5c78d9d35fa9c546d42ecdb7cf180dad to your computer and use it in GitHub Desktop.
Save olafurpg/5c78d9d35fa9c546d42ecdb7cf180dad to your computer and use it in GitHub Desktop.
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