Created
August 14, 2020 09:34
-
-
Save olafurpg/5c78d9d35fa9c546d42ecdb7cf180dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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