diff --git a/.gitignore b/.gitignore index 30ec60e3..561d1b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,4 @@ bin/ .DS_Store # PGP keys -pubring.gpg secring.gpg diff --git a/.travis.yml b/.travis.yml index 11152e09..9327ef3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,14 @@ language: scala scala: - - 2.11.8 +- 2.11.8 jdk: - - oraclejdk8 +- oraclejdk8 script: - - sbt test \ No newline at end of file +- sbt test +- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then + openssl aes-256-cbc -K $encrypted_40545b9562dd_key -iv $encrypted_40545b9562dd_iv + -in secring.gpg.enc -out secring.gpg -d; + fi +after_success: +- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then sbt + compile publishSigned; fi diff --git a/build.sbt b/build.sbt index ef1b5912..81daa82d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,6 @@ lazy val `scala-tutorial` = (project in file(".")) .enablePlugins(ExerciseCompilerPlugin) + .settings(publishSettings:_*) .settings( organization := "org.scala-exercises", name := "exercises-scalatutorial", @@ -17,4 +18,32 @@ lazy val `scala-tutorial` = (project in file(".")) "com.github.alexarchambault" %% "scalacheck-shapeless_1.12" % "0.3.1", compilerPlugin("org.spire-math" %% "kind-projector" % "0.7.1") ) - ) \ No newline at end of file + ) + +// Distribution + +lazy val gpgFolder = sys.env.getOrElse("PGP_FOLDER", ".") + +lazy val publishSettings = Seq( + organizationName := "Scala Exercises", + organizationHomepage := Some(new URL("http://scala-exercises.org")), + startYear := Some(2016), + description := "Scala Exercises: The path to enlightenment", + homepage := Some(url("http://scala-exercises.org")), + pgpPassphrase := Some(sys.env.getOrElse("PGP_PASSPHRASE", "").toCharArray), + pgpPublicRing := file(s"$gpgFolder/pubring.gpg"), + pgpSecretRing := file(s"$gpgFolder/secring.gpg"), + credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", sys.env.getOrElse("PUBLISH_USERNAME", ""), sys.env.getOrElse("PUBLISH_PASSWORD", "")), + scmInfo := Some(ScmInfo(url("https://github.com/scala-exercises/exercises-scalatutorial"), "https://github.com/scala-exercises/exercises-scalatutorial.git")), + licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")), + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := Function.const(false), + publishTo := { + val nexus = "https://oss.sonatype.org/" + if (isSnapshot.value) + Some("Snapshots" at nexus + "content/repositories/snapshots") + else + Some("Releases" at nexus + "service/local/staging/deploy/maven2") + } +) \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index fef1eb88..e2ec115d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ resolvers += Resolver.sonatypeRepo("snapshots") -addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.3.0-SNAPSHOT", "0.13", "2.10") \ No newline at end of file +addSbtPlugin("org.scala-exercises" % "sbt-exercise" % "0.3.0-SNAPSHOT", "0.13", "2.10") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") \ No newline at end of file diff --git a/pubring.gpg b/pubring.gpg new file mode 100644 index 00000000..c7e3925b --- /dev/null +++ b/pubring.gpg @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: BCPG v1.51 + +mQENBFgGJjoBCACkQzvPI+1VtMYz252a3i3wm1dKrsF5v/E//IsYLMsXx/4BICES +bjZchmCbaIqjaNrfBxRAR20KbWVXbUptDJgXA/WOyGEUfDvS6Kfm1F6A34qVyCIr +NPEIeDVM64nLpQFrNuIiFPlTj9eXbKPRbV0eUrtKH59iplB4DCboK4ysGX3Hk/A3 +nzmAf9+Lt9N8vuzO8ymYvdWfdzQsVPCSXkKhK2qpT+ORIPAPWGdXmZ6Rr1wAGwqY ++x0iVSL2IFs5MqDvBbDoyfnt14UVffJlI6O0C+flIY+kSCp86pYQrHHaCnWrnALU +L8Cb/DJ7DODpd99bDHtkuMHUn4BO4WmoI69zABEBAAG0JXNjYWxhLWV4ZXJjaXNl +cyA8ZGV2ZWxvcGVyQDQ3ZGVnLmNvbT6JARwEEwECAAYFAlgGJjoACgkQT9ktcdDT +ZI66CQgAkGDi0EOapqJbFMiNTH85IelGs2c04aNPnEGZh+dUHqpJvA785PduXtzT +XEP8DVP4zgjfGoDyiaJWBVXyg6Ch7XZ6gNodgOS7oQu5nFsA6ZBtwVy0qfRjfK2E +NEIvRuNjQuAlDTDHRfDtZmFIDSd4YR/smJL7BVrO5eT+qsbeluZGGi54TY/zwLbe +TefcUmTixDhm5LGyVPKiEdZwk6o385+9IAFycFozb9K/1NSTBM1GbZBMR/WuACbT +K+DDtqUnGk1cZmNbWzoVabNnubVhGnhMC9AW24pzHu+xEk13yXsPWVikB6NbVg50 +TBkuFf9IEXMEzanKMDDMOatih3a8bg== +=fR5S +-----END PGP PUBLIC KEY BLOCK----- diff --git a/secring.gpg.enc b/secring.gpg.enc new file mode 100644 index 00000000..2f82f161 Binary files /dev/null and b/secring.gpg.enc differ