diff --git a/.travis.yml b/.travis.yml index 38fe6f1..c54d5f2 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: 1ec7ed6de651 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..2a9b721 100644 --- a/build.sbt +++ b/build.sbt @@ -20,10 +20,13 @@ lazy val root = project.in(file(".")) scalaVersion := "2.12.8", crossScalaVersions := Seq("2.11.12", "2.12.8") )) + .enablePlugins(SiteScaladocPlugin) + .enablePlugins(GhpagesPlugin) .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 d7acf4c..640057a 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -26,6 +26,10 @@ 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.makeSite +import com.typesafe.sbt.SbtGit.GitKeys.{gitBranch, gitRemoteRepo} + object BuildSettings { // Basic settings for our app @@ -91,4 +95,12 @@ 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"), + excludeFilter in ghpagesCleanSite := "index.html" + ) } diff --git a/project/docs_init.sh b/project/docs_init.sh new file mode 100755 index 0000000..bd28cff --- /dev/null +++ b/project/docs_init.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# This script is used for initializing the gh-pages branch + +PROJECT_NAME=snowplow-scala-analytics-sdk +PROJECT_REPO=git@github.com:snowplow/snowplow-scala-analytics-sdk.git + +# Using a fresh, temporary clone is safest for this procedure +pushd /tmp +git clone $PROJECT_REPO +cd $PROJECT_NAME + +# Create branch with no history or content +git checkout --orphan gh-pages +git rm -rf . + +# Create index.html file in order to redirect main page +# to /latest/api +cat > index.html <<- EOM + + +
+ +