Skip to content

Set sonatypeCredentialHost at build-level #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import com.typesafe.tools.mima.plugin.MimaPlugin
import sbt._
import xerial.sbt.Sonatype

import scala.annotation.nowarn

import Keys._
import Sonatype.autoImport._
import TypelevelKernelPlugin.autoImport._
Expand All @@ -31,6 +33,10 @@ object TypelevelSonatypePlugin extends AutoPlugin {
override def trigger = allRequirements

object autoImport {
@deprecated(
"Use ThisBuild / sonatypeCredentialHost := xerial.sbt.Sonatype.sonatypeLegacy",
"0.7.3"
)
lazy val tlSonatypeUseLegacyHost =
settingKey[Boolean]("Publish to oss.sonatype.org instead of s01 (default: false)")
}
Expand All @@ -48,25 +54,26 @@ object TypelevelSonatypePlugin extends AutoPlugin {
}
)

@nowarn("cat=deprecation")
override def buildSettings =
Seq(
tlSonatypeUseLegacyHost := false,
autoAPIMappings := true
autoAPIMappings := true,
sonatypeCredentialHost := {
Option(System.getenv("SONATYPE_CREDENTIAL_HOST")).filter(_.nonEmpty).getOrElse {
if (tlSonatypeUseLegacyHost.value)
Sonatype.sonatypeLegacy
else
Sonatype.sonatype01
}
}
)

override def projectSettings = Seq(
publishMavenStyle := true, // we want to do this unconditionally, even if publishing a plugin
sonatypeProfileName := organization.value,
publishTo := sonatypePublishToBundle.value,
commands += sonatypeBundleReleaseIfRelevant,
sonatypeCredentialHost := {
Option(System.getenv("SONATYPE_CREDENTIAL_HOST")).filter(_.nonEmpty).getOrElse {
if (tlSonatypeUseLegacyHost.value)
"oss.sonatype.org"
else
"s01.oss.sonatype.org"
}
},
apiURL := apiURL.value.orElse(hostedApiUrl.value)
)

Expand Down
Loading