Skip to content

Commit

Permalink
Remove gh-pages sbt plugin (close #172)
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Feb 24, 2022
1 parent 76ebf17 commit d6a8a64
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 44 deletions.
35 changes: 6 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: CI

on:
push:
tags:
- '*'
branches:
- master
- develop
Expand All @@ -15,38 +13,17 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Run tests
run: sbt +test
- name: Check assets can be published
run: sbt +publishLocal

- name: Check Scala formatting
run: sbt scalafmtCheckAll
- name: Deploy snowplow-maxmind-iplookups to Maven Central
if: startsWith(github.ref, 'refs/tags/')
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.SONA_PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.SONA_PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONA_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONA_PASS }}
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Publish ScalaDoc
if: startsWith(github.ref, 'refs/tags/')
run: |
project_version=${{ steps.ver.outputs.tag }}
sbt makeSite
echo Publishing Scaladoc
git fetch
git checkout gh-pages
cp -r target/site/$project_version .
git config user.name "GitHub Actions"
git config user.email "<>"
git add $project_version
git commit -m "Added Scaladoc for $project_version"
git push origin gh-pages

- name: Check assets can be published
run: sbt +publishLocal
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: RELEASE

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6

- name: Make site
run: sbt makeSite

- name: Publish ScalaDoc
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: target/site
clean: false

- name: Deploy snowplow-maxmind-iplookups to Maven Central
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.SONA_PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.SONA_PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONA_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONA_PASS }}
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

lazy val root = project
.in(file("."))
.enablePlugins(SiteScaladocPlugin, GhpagesPlugin, PreprocessPlugin)
.enablePlugins(SiteScaladocPlugin, PreprocessPlugin)
.settings(
organization := "com.snowplowanalytics",
name := "scala-maxmind-iplookups",
Expand Down
15 changes: 2 additions & 13 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
import sbt.Keys._
import sbt._
import Keys._

// Scaladocs
import com.typesafe.sbt.sbtghpages.GhpagesPlugin.autoImport._
import com.typesafe.sbt.site.SitePlugin.autoImport.{makeSite, siteSubdirName}
import com.typesafe.sbt.SbtGit.GitKeys.{gitBranch, gitRemoteRepo}
import com.typesafe.sbt.site.SitePlugin.autoImport.siteSubdirName
import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._
import com.typesafe.sbt.site.preprocess.PreprocessPlugin.autoImport._

// dynver plugin
import sbtdynver.DynVerPlugin.autoImport._
Expand Down Expand Up @@ -51,15 +48,7 @@ object BuildSettings {
)

lazy val docSettings = Seq(
ghpagesPushSite := (ghpagesPushSite dependsOn makeSite).value,
ghpagesNoJekyll := false,
gitRemoteRepo := "git@github.com:snowplow/scala-maxmind-iplookups.git",
gitBranch := Some("gh-pages"),
SiteScaladoc / siteSubdirName := s"${version.value}",
Preprocess / preprocessVars := Map("VERSION" -> version.value),
ghpagesCleanSite / excludeFilter := new FileFilter {
def accept(f: File) = true
}
)

lazy val coverageSettings = Seq(
Expand Down
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.13")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
20 changes: 20 additions & 0 deletions src/site-preprocess/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Project Documentation</title>
<script language="JavaScript">
<!--
function doRedirect()
{
window.location.replace("@VERSION@");
}
doRedirect();
//-->
</script>
</head>
<body>
<a href="@VERSION@">Go to the project documentation
</a>
</body>
</html>

0 comments on commit d6a8a64

Please sign in to comment.