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 86f0e5f..56d525f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ project/plugins/project/ .idea/ .idea_modules/ +.bsp/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bfab3fd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -jdk: oraclejdk8 -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_*/com.typesafe.sbt/sbt-digest - # 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 f9df78f..8f8d346 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ sbt-digest will create a second copy of the file with the hash and a digest file ./target/web/digest/images/23dcc403b263f262692ac58437104acf-example.png ./target/web/digest/images/example.png.md5 -[![Build Status](https://travis-ci.org/sbt/sbt-digest.svg?branch=master)](https://travis-ci.org/sbt/sbt-digest) [![Download](https://api.bintray.com/packages/sbt-web/sbt-plugin-releases/sbt-digest/images/download.svg) ](https://bintray.com/sbt-web/sbt-plugin-releases/sbt-digest/_latestVersion) +[![Build Status](https://github.com/sbt/sbt-digest/actions/workflows/build-test.yml/badge.svg)](https://github.com/sbt/sbt-digest/actions/workflows/build-test.yml) Add plugin ---------- @@ -24,7 +24,7 @@ Add plugin Add the plugin to `project/plugins.sbt`. For example: ```scala -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.3") +addSbtPlugin("com.github.sbt" % "sbt-digest" % "2.0.0") ``` Your project's build file also needs to enable sbt-web plugins. For example with build.sbt: @@ -42,9 +42,8 @@ Configuration ### Algorithms -Supported hash algorithms are `md5` and `sha1`. The default is to only create -`md5` checksum files. To configure this, modify the `algorithms` -setting. For example, to also generate`sha1` checksum files: +Supported hash algorithms are `md5` and `sha1`. The default is to only create `md5` checksum files. To configure this, modify the `algorithms` setting. +For example, to also generate`sha1` checksum files: ```scala DigestKeys.algorithms += "sha1" @@ -52,34 +51,28 @@ DigestKeys.algorithms += "sha1" ### Filters -Include and exclude filters can be provided. For example, to only create -checksum files for `.js` files: +Include and exclude filters can be provided. For example, to only create checksum files for `.js` files: ```scala -includeFilter in digest := "*.js" +digest / includeFilter := "*.js" ``` Or to exclude all `.js` files but include any other files: ```scala -excludeFilter in digest := "*.js" +digest / excludeFilter := "*.js" ``` Contribution policy ------------------- -Contributions via GitHub pull requests are gladly accepted from their original -author. Before we can accept pull requests, you will need to agree to the -[Typesafe Contributor License Agreement][cla] online, using your GitHub account. - +Contributions via GitHub pull requests are gladly accepted from their original author. License ------- This code is licensed under the [Apache 2.0 License][apache]. - [sbt-web]: https://github.com/sbt/sbt-web -[cla]: http://www.typesafe.com/contribute/cla [apache]: http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/build.sbt b/build.sbt index ba680c4..1bfcb96 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,26 @@ lazy val `sbt-digest` = project in file(".") +enablePlugins(SbtWebBase) + +sonatypeProfileName := "com.github.sbt.sbt-digest" // See https://issues.sonatype.org/browse/OSSRH-77819#comment-1203625 + description := "sbt-web plugin for adding checksum files for web assets. Checksums are useful for asset fingerprinting and etag values" -addSbtJsEngine("1.2.2") +developers += Developer( + "playframework", + "The Play Framework Team", + "contact@playframework.com", + url("https://github.com/playframework") +) + +addSbtJsEngine("1.3.5") + +// 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 7b6213b..e8a1e24 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.0.1 +sbt.version=1.9.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index 7a1196f..6e4254c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,3 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-web-build-base" % "1.2.0") +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/com/typesafe/sbt/digest/SbtDigest.scala b/src/main/scala/com/typesafe/sbt/digest/SbtDigest.scala index 3bbb949..2eb161e 100644 --- a/src/main/scala/com/typesafe/sbt/digest/SbtDigest.scala +++ b/src/main/scala/com/typesafe/sbt/digest/SbtDigest.scala @@ -37,15 +37,15 @@ object SbtDigest extends AutoPlugin { algorithms := Seq("md5"), indexPath := None, indexWriter := writeJsIndex, - includeFilter in digest := AllPassFilter, - excludeFilter in digest := HiddenFileFilter, + (digest / includeFilter) := AllPassFilter, + (digest / excludeFilter) := HiddenFileFilter, digest := digestStage.value ) def digestStage: Def.Initialize[Task[Pipeline.Stage]] = Def.task { val algs = algorithms.value - val inc = (includeFilter in digest).value - val exc = (excludeFilter in digest).value + val inc = (digest / includeFilter).value + val exc = (digest / excludeFilter).value val target = webTarget.value / digest.key.label val path = indexPath.value val writer = indexWriter.value diff --git a/src/sbt-test/digest/defaults/project/plugins.sbt b/src/sbt-test/digest/defaults/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/defaults/project/plugins.sbt +++ b/src/sbt-test/digest/defaults/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/src/sbt-test/digest/exclude/project/plugins.sbt b/src/sbt-test/digest/exclude/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/exclude/project/plugins.sbt +++ b/src/sbt-test/digest/exclude/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/src/sbt-test/digest/existing/project/plugins.sbt b/src/sbt-test/digest/existing/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/existing/project/plugins.sbt +++ b/src/sbt-test/digest/existing/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/src/sbt-test/digest/include/project/plugins.sbt b/src/sbt-test/digest/include/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/include/project/plugins.sbt +++ b/src/sbt-test/digest/include/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/src/sbt-test/digest/index/project/plugins.sbt b/src/sbt-test/digest/index/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/index/project/plugins.sbt +++ b/src/sbt-test/digest/index/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/src/sbt-test/digest/sha1/project/plugins.sbt b/src/sbt-test/digest/sha1/project/plugins.sbt index 1736751..a757480 100644 --- a/src/sbt-test/digest/sha1/project/plugins.sbt +++ b/src/sbt-test/digest/sha1/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % sys.props("project.version")) +addSbtPlugin("com.github.sbt" % "sbt-digest" % sys.props("project.version")) diff --git a/version.sbt b/version.sbt deleted file mode 100644 index 9e05db5..0000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version in ThisBuild := "1.1.5-SNAPSHOT"