diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fccf93a..3a7fc80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,6 @@ name: CI on: push: - tags: - - '*' branches: - master - develop @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..20d12bb --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 46d3cd5..ca1d51b 100644 --- a/build.sbt +++ b/build.sbt @@ -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", diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 1274378..fe73fd3 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -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._ @@ -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( diff --git a/project/plugins.sbt b/project/plugins.sbt index baf0b56..d748e33 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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") diff --git a/src/site-preprocess/index.html b/src/site-preprocess/index.html new file mode 100644 index 0000000..66e62a4 --- /dev/null +++ b/src/site-preprocess/index.html @@ -0,0 +1,20 @@ + + +
+ +