Skip to content

Commit

Permalink
Add sbt-ci-release plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
timaliberdov committed Jan 16, 2024
1 parent d711eab commit cf5347b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 4 additions & 13 deletions project/Publishing.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import sbt.Def
import sbt.Keys.*
import sbt.{Credentials, Def, Path, fileToRichFile, toRepositoryName}
import xerial.sbt.Sonatype.GitHubHosting
import xerial.sbt.Sonatype.autoImport.sonatypeProjectHosting

object Publishing {
private val loadCredentialsFromSystemPropsOrFile = credentials += {
val fromSystemProps = for {
user <- sys.props.get("scala_plugin_deps_user")
pwd <- sys.props.get("scala_plugin_deps_password")
} yield Credentials(realm = null, host = "packages.jetbrains.team", userName = user, passwd = pwd)

fromSystemProps
.getOrElse(Credentials(Path.userHome / ".sbt" / ".scala_plugin_deps_credentials"))
}

private val publishIfNotSnapshot = publish := {
if (isSnapshot.value)
sys.error("Do not publish snapshot versions. Set a tag 'vX.Y.Z' to proceed. Example: v3.20.2")
Expand All @@ -20,9 +12,8 @@ object Publishing {
}

val settings: Seq[Def.Setting[?]] = Seq(
publishTo := Some("Scala Plugin Dependencies" at "https://packages.jetbrains.team/maven/p/scl/scala-plugin-deps"),
sonatypeProjectHosting := Some(GitHubHosting("JetBrains", "sbt-kotlin-plugin", "scala-developers@jetbrains.com")),
versionScheme := Some("semver-spec"),
loadCredentialsFromSystemPropsOrFile,
publishIfNotSnapshot,
)
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

0 comments on commit cf5347b

Please sign in to comment.