Properly set sonatype repo settings for publishTo

This commit is contained in:
Matthew de Detrich 2023-01-26 12:22:57 +01:00 committed by Matthew de Detrich
parent 1cca2212d6
commit beb13d23ef

View file

@ -16,18 +16,20 @@ package org.apache.pekko
import sbt._
import sbt.Keys._
import com.lightbend.sbt.publishrsync.PublishRsyncPlugin.autoImport.publishRsyncHost
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName
import xerial.sbt.Sonatype.autoImport._
object Publish extends AutoPlugin {
override def trigger = allRequirements
private val apacheBaseRepo = "repository.apache.org"
override lazy val projectSettings = Seq(
publishTo := Some(pekkoPublishTo.value),
publishRsyncHost := "akkarepo@gustav.akka.io",
credentials ++= apacheNexusCredentials,
organizationName := "Apache Software Foundation",
organizationHomepage := Some(url("https://www.apache.org")),
sonatypeCredentialHost := apacheBaseRepo,
sonatypeProfileName := "org.apache.pekko",
startYear := Some(2022),
developers := List(
@ -39,17 +41,10 @@ object Publish extends AutoPlugin {
publishMavenStyle := true,
pomIncludeRepository := (_ => false))
private def pekkoPublishTo = Def.setting {
if (isSnapshot.value)
"apache-snapshots".at("https://repository.apache.org/content/repositories/snapshots")
else
Opts.resolver.sonatypeStaging
}
private def apacheNexusCredentials: Seq[Credentials] =
(sys.env.get("NEXUS_USER"), sys.env.get("NEXUS_PW")) match {
case (Some(user), Some(password)) =>
Seq(Credentials("Apache Nexus Repository Manager", "repository.apache.org", user, password))
Seq(Credentials("Apache Nexus Repository Manager", apacheBaseRepo, user, password))
case _ =>
Seq.empty
}