forked from pfn/kotlin-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a27e2a
commit d6c02d8
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import sbt.Keys.* | ||
import sbt.{Credentials, Def, Path, fileToRichFile, toRepositoryName} | ||
|
||
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") | ||
else | ||
publish.value | ||
} | ||
|
||
val settings: Seq[Def.Setting[?]] = Seq( | ||
publishTo := Some("Scala Plugin Dependencies" at "https://packages.jetbrains.team/maven/p/scl/scala-plugin-deps"), | ||
versionScheme := Some("semver-spec"), | ||
loadCredentialsFromSystemPropsOrFile, | ||
publishIfNotSnapshot, | ||
) | ||
} |