diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8a2f2b9..d9ba8a5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,53 @@ -name: Publish new Release +name: Test and publish a new release on: - release: - types: [published] - branches: [master] + push: + tags: + - 'v*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + SBT_CREDENTIALS: '.credentials' jobs: - release: - uses: evolution-gaming/scala-github-actions/.github/workflows/release.yml@v1 - secrets: inherit + publish-release: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: coursier/cache-action@v6 + + - name: setup Java and SBT + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'oracle' + cache: 'sbt' + + - name: setup credentials + run: | + echo "realm=Artifactory Realm" >> ${{ env.SBT_CREDENTIALS }} + echo "host=evolution.jfrog.io" >> ${{ env.SBT_CREDENTIALS }} + echo "user=github-publish" >> ${{ env.SBT_CREDENTIALS }} + echo "password=${{secrets.JFROG_ACCESS_TOKEN}}" >> ${{ env.SBT_CREDENTIALS }} + + - name: check, test and package + run: sbt "clean; versionPolicyCheck; +all test package" + + - name: publish on JFrog Artifactory + run: sbt "+publish" + + - name: cleanup credentials + if: always() + run: rm -rf ${{ env.SBT_CREDENTIALS }} + + - name: delete tag + if: failure() + run: git push --delete origin ${{ github.ref_name }} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 0a87448d..45ed2561 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,6 @@ lazy val commonSettings = Seq( scalaVersion := crossScalaVersions.value.head, crossScalaVersions := Seq("2.13.12", "3.3.1", "2.12.18"), licenses := Seq(("MIT", url("https://opensource.org/licenses/MIT"))), - releaseCrossBuild := true, Compile / doc / scalacOptions += "-no-link-warnings", scalacOptions ++= crossSettings( scalaVersion.value, diff --git a/project/plugins.sbt b/project/plugins.sbt index 81fabaa3..af3bcc76 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11") -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") addSbtPlugin("com.evolution" % "sbt-scalac-opts-plugin" % "0.0.9") diff --git a/version.sbt b/version.sbt deleted file mode 100644 index 0c5e7121..00000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -ThisBuild / version := "17.1.1-SNAPSHOT"