From b57119dff246336787be739d116d7df31a3c4833 Mon Sep 17 00:00:00 2001 From: Enes Aldemir Date: Fri, 16 Aug 2019 14:04:14 +0300 Subject: [PATCH] Integrate sbt-gh-pages to create GH Pages from Scaladoc (closes #91) --- .travis.yml | 1 + .travis/deploy.sh | 1 + .travis/deploy_docs.sh | 17 +++++++++++++++++ build.sbt | 4 ++++ project/BuildSettings.scala | 18 ++++++++++++++++++ project/plugins.sbt | 5 ++++- project/travis-deploy-key.enc | Bin 0 -> 3392 bytes src/site-preprocess/index.html | 20 ++++++++++++++++++++ 8 files changed, 65 insertions(+), 1 deletion(-) create mode 100755 .travis/deploy_docs.sh create mode 100644 project/travis-deploy-key.enc create mode 100644 src/site-preprocess/index.html diff --git a/.travis.yml b/.travis.yml index 38fe6f1..76d4d87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,3 +23,4 @@ env: # SONA_PASS - secure: oDu2dXzektYr/7K5nw7EL2qDUR5AhO4Uz6XGHoOQsN1gJiovdsa5nJeDHgo2YFGpJljyTo+lABbxpGIFQpcnKGIG9eAaXIyYpRlEiksTUnZdwIlCXkRMg2l9cUr30ZDOoVS8QpQbCDdogOSqJ+RUShSuiXR8Qi2e0RfrsVucgkNogQ6w1IoB9kV8CAYsnJVzi/oenTJZjEh5qrKiUALpkiHGjB9WSIHQ80sAO/rwnr88w++HcOIqgnvhJ3/Ig3N6201Slud5pF2yVz4MxzY8bedetqNil5ffosYiU7dladOiKTVj8efZPx0cGq0dhpAZFVhehlXyu4EA24NRgKYvAIc0xWVVm49IBaMpDDI/nh24uF9fBPt2+Apj5BY/ETpKS5tFqFaGkBjlL9KFL3l2DfnWC8AfTHlBXFlkH8tKPSN4so612QAmWuULtrVuQpV8DF40HNwJoR2Lyyy5aHrZtpdjHsp3OJI83QfCxH2yTYhes4eHAxi4ynZDSDolt6mrjx651mmlQCsJWJ5KdWHQwjqzgRP8q1/bCaDYdODhrz0K1JPl6YYA+dzwRP+rFeSQbzG0yGo12p7FZGpq36/Hq9C/HSw6WVDN3Lr8CUxZr1rDhtmAvaMJG5EyYDXpNGn9j2DJX76A1Ifu7KXCp8h+FTLPa1CIxJruNxEA6vFSdqA= - SONA_USER=snowplow + - ENCRYPTION_LABEL: diff --git a/.travis/deploy.sh b/.travis/deploy.sh index 05b06fe..884d020 100755 --- a/.travis/deploy.sh +++ b/.travis/deploy.sh @@ -18,6 +18,7 @@ pwd project_version=$(sbt version -Dsbt.log.noformat=true | perl -ne 'print $1 if /(\d+\.\d+\.\d+[^\r\n]*)/') if [ "${project_version}" == "${tag_version}" ]; then + ./.travis/deploy_docs.sh sbt +publish sbt +bintraySyncMavenCentral else diff --git a/.travis/deploy_docs.sh b/.travis/deploy_docs.sh new file mode 100755 index 0000000..164d44b --- /dev/null +++ b/.travis/deploy_docs.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" +ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" +ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} +ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} + +git config --global user.name "$USER" +git config --global user.email "$TRAVIS_BUILD_NUMBER@$TRAVIS_COMMIT" + +openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in project/travis-deploy-key.enc -out project/travis-deploy-key -d +chmod 600 project/travis-deploy-key + +eval "$(ssh-agent -s)" +ssh-add project/travis-deploy-key + +sbt ghpagesPushSite diff --git a/build.sbt b/build.sbt index bd4aeec..1ed9a31 100644 --- a/build.sbt +++ b/build.sbt @@ -20,10 +20,14 @@ lazy val root = project.in(file(".")) scalaVersion := "2.12.8", crossScalaVersions := Seq("2.11.12", "2.12.8") )) + .enablePlugins(SiteScaladocPlugin) + .enablePlugins(GhpagesPlugin) + .enablePlugins(PreprocessPlugin) .settings(BuildSettings.buildSettings) .settings(BuildSettings.publishSettings) .settings(BuildSettings.mimaSettings) .settings(BuildSettings.scoverageSettings) + .settings(BuildSettings.ghPagesSettings) .settings(Seq( shellPrompt := { _ => name.value + " > " } )) diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 4c7d071..914fc29 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -26,6 +26,12 @@ import com.typesafe.tools.mima.plugin.MimaPlugin // Scoverage plugin import scoverage.ScoverageKeys._ +import com.typesafe.sbt.sbtghpages.GhpagesPlugin.autoImport._ +import com.typesafe.sbt.site.SitePlugin.autoImport._ +import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._ +import com.typesafe.sbt.SbtGit.GitKeys.{gitBranch, gitRemoteRepo} +import com.typesafe.sbt.site.preprocess.PreprocessPlugin.autoImport._ + object BuildSettings { // Basic settings for our app @@ -91,4 +97,16 @@ object BuildSettings { (coverageReport dependsOn (test in Test)).value } ) + + val ghPagesSettings = Seq( + ghpagesPushSite := (ghpagesPushSite dependsOn makeSite).value, + ghpagesNoJekyll := false, + gitRemoteRepo := "git@github.com:snowplow/snowplow-scala-analytics-sdk.git", + gitBranch := Some("gh-pages"), + siteSubdirName in SiteScaladoc := s"${version.value}", + preprocessVars in Preprocess := Map("VERSION" -> version.value), + excludeFilter in ghpagesCleanSite := new FileFilter { + def accept(f: File) = true + } + ) } diff --git a/project/plugins.sbt b/project/plugins.sbt index 5888fe2..3db8a8c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,6 @@ addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.3") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.5.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") diff --git a/project/travis-deploy-key.enc b/project/travis-deploy-key.enc new file mode 100644 index 0000000000000000000000000000000000000000..eed0d2caccf4bf61c3334644fd386a6d6d7be63d GIT binary patch literal 3392 zcmV-G4Zrd^K71EP&x&X82{Y_u!&G#1I`iMLx>|DqKu}2 z%n0xZl!KI4^+r%&pUI5&CQ3jSyE3(jfAwZ#a zuEe69dWg1ERljV4olFZZyyxe(9{8w*&Wa%67h*B|OAj^$!H1VXY|5{Dn0ovo(@oPx z|3Bg|I>4~~{f10cM4*8j6fC8wRWAADwVDMJ83GKHJ)^%NCt<}n6uxjt>FE>mr~4`d z0s-QneRfS|Za$DU=WW~S0n7~s78Ib#vKrf*Y>s(j^ps#?^8ax_n-?R#+ijDm^$MZL0D~XC;5SHc=Su3M-)o2`_s83u@AW#=tR>0F5V;RImF z>0nMB^?{1{1oxitG;h-pI!q++0~;~%#y2exd^Yhmq&xdP$5I<082Q2GP1|q-;ufMQ zKT|4aD9Q2cp}?G|MhJI%U|Vgj0;~SnH3H5LrDlN!vLWR>L8|~_r2-#Yv50d9%1G;D zz#|Kw>vfjmbbMxVkkVOxqKC#(l|QzU6tCDDp)scug5Ad>&|aQc*==Qv9Z7GYo$TrZ zmltn4k&dN~taE^;qj=x$NIA-cHb8mMMHJ^@AE5uVp2A7M`b(t%iNRa`$q9Q=Oh zP+?Kv@C(u?21M>2(M?w5A@v_wTz7M)JJ_T!?uL~?;+ES>wzL|pOZfr zyp&bYG9&ohv;^-=*>^rxaCV{}@~-x)wQalFIYq(DHvgjLONd7HIHqU%Q1w(5Hl{}F z$|=!^(U4QmDN`gWa$qW+HHSzQfx0qUf^SHcVKG=pOUa*867eYtSe_w z<><&*BBLn|Pi?B;(%OHWb%kYX@AB$W+XRv?tQMO-A~*xsOPjqw!$&jL9S7=P!2el^_gg_ z+=?e?CRTt~ni>Xmq$^`sZwu&`Nw{Cu5~26E212U#T*MM+YxFDaEiDxt=dG8vLn}dp zw3j4p1D_Sx)xuhlyUZ4^zUB=M?`7;X7t$v(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