-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
fix warnings
Showing
3 changed files
with
17 additions
and
11 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
version=3.8.3 | ||
maxColumn = 140 | ||
maxColumn=140 | ||
dialect=scala212 |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ import sbt.Keys._ | |
import sbt._ | ||
import sbtdynver.DynVerPlugin.autoImport.dynverTagPrefix | ||
import xerial.sbt.Sonatype.autoImport.{sonatypeProfileName, sonatypeCredentialHost} | ||
import java.net.URI | ||
|
||
trait Publish { | ||
lazy val ossPublishSettings = Seq( | ||
|
@@ -18,7 +19,7 @@ trait Publish { | |
id = "softwaremill", | ||
name = "SoftwareMill", | ||
email = "[email protected]", | ||
url = new URL("https://softwaremill.com") | ||
url = URI.create("https://softwaremill.com").toURL() | ||
) | ||
), | ||
updateDocs := UpdateVersionInDocs(sLog.value, organization.value, version.value), | ||
|
@@ -34,26 +35,26 @@ trait Publish { | |
private val releaseCommand = Command.command("release") { state => | ||
var s = state | ||
s.log.info("Current version:") | ||
s = Command.process("version", s) | ||
s = processCommandOrThrow("version", s) | ||
val version = readNextVersion() | ||
|
||
val tagPrefix = Project.extract(s).getOpt(ThisBuild / dynverTagPrefix).getOrElse("v") | ||
val tag = tagPrefix + version | ||
|
||
s = Command.process(s"""set ThisBuild/version := "$version"""", s) | ||
s = processCommandOrThrow(s"""set ThisBuild/version := "$version"""", s) | ||
|
||
val (s2, files) = Project.extract(s).runTask(updateDocs, s) | ||
s = s2 | ||
s = addFilesToGit(s, files) | ||
|
||
s.log.info(s"\nDocs updated, git status:\n") | ||
s = Command.process(s"git status", s) | ||
s = processCommandOrThrow(s"git status", s) | ||
s.log.info(s"\n") | ||
|
||
s = Command.process(s"""git commit -m "Release $version"""", s) | ||
s = processCommandOrThrow(s"""git commit -m "Release $version"""", s) | ||
|
||
s.log.info(s"Tagging release as: $tag") | ||
s = Command.process(s"git tag $tag", s) | ||
s = processCommandOrThrow(s"git tag $tag", s) | ||
|
||
s = pushChanges(s) | ||
s | ||
|
@@ -68,16 +69,19 @@ trait Publish { | |
|
||
private def addFilesToGit(state: State, fs: Seq[File]): State = | ||
fs.foldLeft(state) { case (s, f) => | ||
Command.process(s"git add ${f.getAbsolutePath}", s) | ||
processCommandOrThrow(s"git add ${f.getAbsolutePath}", s) | ||
} | ||
|
||
private def pushChanges(state: State): State = | ||
SimpleReader.readLine("Push changes? [y/n] ") match { | ||
case Some("y") => | ||
val state2 = Command.process(s"git push", state) | ||
Command.process(s"git push --tags", state2) | ||
val state2 = processCommandOrThrow(s"git push", state) | ||
processCommandOrThrow(s"git push --tags", state2) | ||
case _ => sys.error("Aborting, not pushing changes"); state | ||
} | ||
|
||
private def processCommandOrThrow(command: String, state: State): State = | ||
Command.process(command, state, msg => throw new RuntimeException(msg)) | ||
} | ||
|
||
object Publish extends Publish |