Publish snapshots to gustav with 'publish' (#28815)

This removes the need to publish to a 'predictable' directory and then
'manually' rsyncing the locally-created repository from jenkins to gustav.

This is not needed for anything, it just simplifies the build a bit. We
could eventually use it for the paradox and api docs as well.
This commit is contained in:
Arnout Engelen 2020-03-27 10:30:38 +01:00 committed by GitHub
parent dc678a6319
commit b34e26eff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View file

@ -17,7 +17,7 @@ object Publish extends AutoPlugin {
override lazy val projectSettings = Seq(
pomExtra := akkaPomExtra,
publishTo := akkaPublishTo.value,
publishTo := Some(akkaPublishTo.value),
credentials ++= akkaCredentials,
organizationName := "Lightbend Inc.",
organizationHomepage := Some(url("https://www.lightbend.com")),
@ -40,21 +40,16 @@ object Publish extends AutoPlugin {
}
private def akkaPublishTo = Def.setting {
sonatypeRepo(version.value).orElse(localRepo(defaultPublishTo.value))
val key = new java.io.File(
Option(System.getProperty("akka.gustav.key")).getOrElse(System.getProperty("user.home") + "/.ssh/id_rsa_gustav.pem"))
if (isSnapshot.value)
Resolver.sftp("Akka snapshots", "gustav.akka.io", "/home/akkarepo/www/snapshots").as("akkarepo", key)
else
Opts.resolver.sonatypeStaging
}
private def sonatypeRepo(version: String): Option[Resolver] =
Option(sys.props("publish.maven.central")).filter(_.toLowerCase == "true").map { _ =>
val nexus = "https://oss.sonatype.org/"
if (version.endsWith("-SNAPSHOT")) "snapshots".at(nexus + "content/repositories/snapshots")
else "releases".at(nexus + "service/local/staging/deploy/maven2")
}
private def localRepo(repository: File) =
Some(Resolver.file("Default Local Repository", repository))
private def akkaCredentials: Seq[Credentials] =
Option(System.getProperty("akka.publish.credentials", null)).map(f => Credentials(new File(f))).toSeq
Option(System.getProperty("akka.publish.credentials")).map(f => Credentials(new File(f))).toSeq
}
/**

View file

@ -64,7 +64,12 @@
# 3.2) Install your public ssh key to avoid typing in your password.
# From the command line:
# shell> cat ~/.ssh/id_rsa.pub | ssh akkarepo@gustav.akka.io "cat >> ~/.ssh/authorized_keys"
##
#
# 3.3) Also make it available for publishing snapshots.
# From the command line:
# shell> cp ~/.ssh/id_rsa.pub ~/.ssh/id_rsa_gustav.pem
# shell> ssh-keygen -p -f ~/.ssh/id_rsa_gustav.pem -m pem
#
# 4) Have access to github.com/akka/akka. This should be a given.
#
# Now you should be all set to run the script