From 6539bca254484b17054e53ecfcbd57dedbd21ca9 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Sat, 7 Dec 2019 01:11:00 +0100 Subject: [PATCH] Upgrade to latest sbt-web, use GHA/sbt-ci-release --- .github/workflows/build-test.yml | 30 +++++++++++++ .github/workflows/publish.yml | 44 +++++++++++++++++++ .gitignore | 1 + .travis.yml | 12 ----- README.md | 4 +- build.sbt | 26 +++++++++-- project/build.properties | 2 +- project/plugins.sbt | 3 +- .../ground5hark/sbt/concat/SbtConcat.scala | 8 ++-- .../sbt-concat/simple/project/plugins.sbt | 2 +- version.sbt | 1 - 11 files changed, 107 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml delete mode 100644 version.sbt diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..6ab438e --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,30 @@ +name: Check + +on: + pull_request: + + push: + branches: + - main # Check branch after merge + +concurrency: + # Only run once for latest commit per ref and cancel other (previous) runs. + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Tests + uses: playframework/.github/.github/workflows/cmd.yml@v3 + with: + java: 17, 11, 8 + scala: 2.12.18 + cmd: | + sbt ++$MATRIX_SCALA test ^scripted + + finish: + name: Finish + if: github.event_name == 'pull_request' + needs: # Should be last + - "tests" + uses: playframework/.github/.github/workflows/rtm.yml@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6a6c3ae --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish + +on: + push: + branches: # Snapshots + - main + tags: ["**"] # Releases + +jobs: + publish-artifacts: + name: JDK 8 + runs-on: ubuntu-20.04 + if: ${{ github.repository_owner == 'sbt' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves + fetch-depth: 0 + + - name: Coursier Cache + id: coursier-cache + uses: coursier/cache-action@v6 + + - name: Install Adoptium Temurin OpenJDK + uses: coursier/setup-action@v1 + with: + jvm: adoptium:8 + + - name: Publish artifacts + run: sbt ci-release + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + + - name: Cleanup before cache + shell: bash + run: | + find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true diff --git a/.gitignore b/.gitignore index ffb89dd..3c65298 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea .idea_modules target +.bsp/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1bc9ea2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -jdk: openjdk8 -language: scala -sudo: false -script: sbt ^scripted -cache: - directories: - - $HOME/.ivy2/cache -before_cache: - # Ensure changes to the cache aren't persisted - - rm -rf $HOME/.ivy2/cache/scala_*/sbt_*/net.ground5hark.sbt/sbt-concat - # Delete all ivydata files since ivy touches them on each build - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm diff --git a/README.md b/README.md index 032b2ad..12edbb0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ sbt-concat ========== -[![Build Status](https://api.travis-ci.org/sbt/sbt-concat.png?branch=master)](https://travis-ci.org/sbt/sbt-concat) [![Download](https://api.bintray.com/packages/sbt-web/sbt-plugin-releases/sbt-concat/images/download.svg)](https://bintray.com/sbt-web/sbt-plugin-releases/sbt-concat/_latestVersion) +[![Build Status](https://github.com/sbt/sbt-concat/actions/workflows/build-test.yml/badge.svg)](https://github.com/sbt/sbt-concat/actions/workflows/build-test.yml) [sbt-web] plugin for concatenating files together, using the sbt-web asset pipeline. @@ -8,7 +8,7 @@ Plugin ====== Add the plugin to your `project/plugins.sbt`: ```scala -addSbtPlugin("net.ground5hark.sbt" % "sbt-concat" % "0.2.0") +addSbtPlugin("com.github.sbt" % "sbt-concat" % "1.0.0") ``` Enable the [sbt-web] plugin for your project: diff --git a/build.sbt b/build.sbt index 689db9a..ff0368e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,10 +1,28 @@ lazy val `sbt-concat` = project in file(".") -organization := "net.ground5hark.sbt" -name := "sbt-concat" +enablePlugins(SbtWebBase) + +sonatypeProfileName := "com.github.sbt.sbt-concat" // See https://issues.sonatype.org/browse/OSSRH-77819#comment-1203625 + description := "sbt-web asset concatenation plugin" -enablePlugins(SbtWebBase) -addSbtWeb("1.4.3") +developers += Developer( + "playframework", + "The Play Framework Team", + "contact@playframework.com", + url("https://github.com/playframework") +) + +addSbtWeb("1.5.3") licenses := Seq("MIT" -> url("https://opensource.org/licenses/mit-license.php")) + +// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed +ThisBuild / dynverVTagPrefix := false + +// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone) +// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version +Global / onLoad := (Global / onLoad).value.andThen { s => + dynverAssertTagVersion.value + s +} diff --git a/project/build.properties b/project/build.properties index 7c58a83..e8a1e24 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.6 +sbt.version=1.9.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 1726c9e..6e4254c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-web-build-base" % "1.2.1") +addSbtPlugin("com.github.sbt" % "sbt-web-build-base" % "2.0.2") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") diff --git a/src/main/scala/net/ground5hark/sbt/concat/SbtConcat.scala b/src/main/scala/net/ground5hark/sbt/concat/SbtConcat.scala index 29f0427..569e33f 100644 --- a/src/main/scala/net/ground5hark/sbt/concat/SbtConcat.scala +++ b/src/main/scala/net/ground5hark/sbt/concat/SbtConcat.scala @@ -42,7 +42,7 @@ object SbtConcat extends AutoPlugin { override def projectSettings = Seq( groups := ListBuffer.empty[ConcatGroup], - includeFilter in concat := NotHiddenFileFilter, + concat / includeFilter := NotHiddenFileFilter, parentDir := "", concat := concatFiles.value ) @@ -64,15 +64,15 @@ object SbtConcat extends AutoPlugin { val logValue = streams.value.log mappings: Seq[PathMapping] => val groupsValue = toFileNames(groups.value, - (sourceDirectories in Assets).value, - (webModuleDirectories in Assets).value) + (Assets / sourceDirectories).value, + (Assets / webModuleDirectories).value) val groupMappings = if (groupsValue.nonEmpty) { logValue.info(s"Building ${groupsValue.size} concat group(s)") // Mutable map so we can pop entries we've already seen, in case there are similarly named files val reverseMapping = ReverseGroupMapping.get(groupsValue, logValue) val concatGroups = mutable.Map.empty[String, StringBuilder] - val filteredMappings = mappings.filter(m => (includeFilter in concat).value.accept(m._1) && m._1.isFile) + val filteredMappings = mappings.filter(m => (concat / includeFilter).value.accept(m._1) && m._1.isFile) val targetDir = webTarget.value / parentDir.value groupsValue.foreach { diff --git a/src/sbt-test/sbt-concat/simple/project/plugins.sbt b/src/sbt-test/sbt-concat/simple/project/plugins.sbt index 5e02001..dc8b78e 100644 --- a/src/sbt-test/sbt-concat/simple/project/plugins.sbt +++ b/src/sbt-test/sbt-concat/simple/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("net.ground5hark.sbt" %% "sbt-concat" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" %% "sbt-concat" % sys.props("project.version")) diff --git a/version.sbt b/version.sbt deleted file mode 100644 index 6f9d847..0000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version := "0.1.11-SNAPSHOT"