Skip to content
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

FIX #1148 travis release #1149

Merged
merged 5 commits into from
Aug 25, 2018
Merged
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ matrix:
before_script:
- curl -L --create-dirs -o $HOME/.sbt/launchers/1.1.6/sbt-launch.jar http://dl.bintray.com/sbt/maven-releases/org/scala-sbt/sbt-launch/1.1.6/sbt-launch.jar


before_deploy:
- gpg --import project/.gnupg/key.asc
- gem install github_changelog_generator

deploy:
- provider: script
script: sbt release
skip_cleanup: true
on:
tags: true
condition: $TRAVIS_PULL_REQUEST = false
- provider: script
script: sbt release
skip_cleanup: true
on:
branch: snapshot
condition: $TRAVIS_PULL_REQUEST = false

addons:
apt:
packages:
Expand All @@ -72,3 +91,8 @@ cache:
- $HOME/.sbt
- $HOME/.m2
- $HOME/.ivy2

env:
global:
- secure: bK5zEd2s3y+ScGwuGcxlP0tXx83nvurmF/SWuQSmI0A2KRelipGSSY2BTa+URKk9smJusJIZUi72EqEwMHDhxLCfHomjze5BmpJB5Mr3fQI700nxPEA95cbM4Z1G9+K6fYWy2pi5S7Xmz1Sg07bP4sfzyVYlNB20aquLCmB9Llk=
- secure: iY6MLAx39wW8y4uPZxt86FiNkLdrVHaAKCIcp7P35c0Zi1T0aaPTVTwZMS1uJAYs7e3Nh7gv7yU0hZR6t3klYPNjQdS7LHTgITIejBmikkBTkVqfpIYEOyrfDSaT59YlGrBiidegEGnw84kD4dFDmjnUY0ViCwOpJKr0a0Iokls=
10 changes: 2 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,17 @@ git.remoteRepo := "[email protected]:sbt/sbt-native-packager.git"
scriptedLaunchOpts += "-Dproject.version=" + version.value

// Release configuration
releasePublishArtifactsAction := PgpKeys.publishSigned.value
publishMavenStyle := false

// The release task doesn't run any tests. We rely on travis.ci and appveyor,
// because it's impossible to run all tests (linux, macosx, windows) on a single computer.
import ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepTask(dynverCheckVersion),
updateReadme,
commitReadme,
releaseStepCommandAndRemaining("^ publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommandAndRemaining("^ publish"),
pushChanges,
generateReleaseChangelog,
commitChangelog,
Expand Down
Binary file added project/.gnupg/key.asc.enc
Binary file not shown.
21 changes: 14 additions & 7 deletions project/ChangelogPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ import scala.sys.process._
* - generated for all available version tasks
* - runs in verbose mode
*
*
* == Travis configuration ==
*
* The travis repository settings contain the `CHANGELOG_GITHUB_TOKEN` environment variable
* to make the release process unattended.
*
* @see [[https://github.com/skywinder/github-changelog-generator]]
* @see [[https://github.com/skywinder/github-changelog-generator/wiki/Advanced-change-log-generation-examples]]
*/
Expand Down Expand Up @@ -80,7 +86,10 @@ object ChangelogPlugin extends AutoPlugin {
val extracted = Project.extract(state)
val predefinedToken = extracted.get(generateChangelogToken)

val githubToken = readToken(predefinedToken)
// if no input token is provided we rely on the `CHANGELOG_GITHUB_TOKEN` env variable
val githubToken = readToken(predefinedToken).map {
githubToken => s" --token $githubToken"
}.getOrElse("")

val (newState, _) = extracted.runInputTask(generateChangelog, s" --token $githubToken", state)
newState
Expand Down Expand Up @@ -135,11 +144,9 @@ object ChangelogPlugin extends AutoPlugin {
override def buffer[T](f: => T): T = state.log.buffer(f)
}

private def readToken(predefinedToken: Option[String]): String =
predefinedToken.getOrElse(SimpleReader.readLine("Github token: ") match {
case Some(input) if input.trim.isEmpty => sys.error("No token provided")
case Some(input) => input
case None => sys.error("No token provided")
})
private def readToken(predefinedToken: Option[String]): Option[String] =
predefinedToken
.orElse(Option(SimpleReader.readLine("Github token: ").mkString))
.filter(_.nonEmpty)

}
6 changes: 4 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.6")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")

addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.0")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "3.0.0")

libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

// Scripted plugin needs to declare this as a dependency
libraryDependencies += "jline" % "jline" % "2.11"

// For our bintray publishing
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")

// For code formatting
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.