Skip to content

Commit

Permalink
Properly include the base path of the publish-destination URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Feb 5, 2018
1 parent 94f1ecf commit 6fc66df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def releaseManual(githubAuthKey: String,
scalajslib.jsbridges("0.6"),
scalajslib.jsbridges("1.0")
)
)
)()

val (release, label) = publishVersion()
uploadToGithub(releaseAssembly().path, githubAuthKey, release, label)
Expand Down
15 changes: 9 additions & 6 deletions scalalib/src/mill/scalalib/publish/SonatypePublisher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ class SonatypePublisher(uri: String,
}
def publishAll(artifacts: (Seq[(Path, String)], Artifact)*): Unit = {

val mappings = for ((fileMapping, artifact) <- artifacts) yield {
val mappings = for ((fileMapping0, artifact) <- artifacts) yield {
val publishPath = Seq(
artifact.group.replace(".", "/"),
artifact.id,
artifact.version
).mkString("/")
val fileMapping = fileMapping0.map{ case (file, name) => (file, publishPath+"/"+name) }

val signedArtifacts = fileMapping ++ fileMapping.map {
case (file, name) => poorMansSign(file, gpgPassphrase) -> s"$name.asc"
Expand All @@ -44,12 +45,13 @@ class SonatypePublisher(uri: String,
}
}

val (snapshots, nonSnapshots) = mappings.partition(_._1.isSnapshot)
val (snapshots, releases) = mappings.partition(_._1.isSnapshot)
if(snapshots.nonEmpty) {
publishSnapshot(snapshots.flatMap(_._2), snapshots.map(_._1))
}
if(nonSnapshots.nonEmpty) {
publishRelease(nonSnapshots.flatMap(_._2), nonSnapshots.map(_._1))
val releaseGroups = releases.groupBy(_._1.group)
for((group, groupReleases) <- releaseGroups){
publishRelease(groupReleases.flatMap(_._2), group, releases.map(_._1))
}
}

Expand All @@ -66,10 +68,11 @@ class SonatypePublisher(uri: String,
}

private def publishRelease(payloads: Seq[(String, Array[Byte])],
stagingProfile: String,
artifacts: Seq[Artifact]): Unit = {
val profileUri = api.getStagingProfileUri(artifacts.map(_.group).mkString("-"))
val profileUri = api.getStagingProfileUri(stagingProfile)
val stagingRepoId =
api.createStagingRepo(profileUri, artifacts.map(_.group).mkString("-"))
api.createStagingRepo(profileUri, stagingProfile)
val baseUri = s"$uri/staging/deployByRepositoryId/$stagingRepoId/"

val publishResults = payloads.map {
Expand Down

0 comments on commit 6fc66df

Please sign in to comment.