From 2fcf0ce70037d14d0b986531af561cff4c803dd1 Mon Sep 17 00:00:00 2001 From: Gosha Kovalyov Date: Wed, 1 Jan 2025 12:43:52 +0500 Subject: [PATCH] sbt-ci-release pipeline --- .github/workflows/release.yml | 23 ++++++++++++++++++++++ .github/workflows/scala.yml | 13 +++++++----- build.sbt | 20 ++++++++++++++++++- project/build.properties | 2 +- project/plugins.sbt | 2 +- publishing.sbt | 37 ----------------------------------- 6 files changed, 52 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 publishing.sbt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..9a4d2bb4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release +on: + push: + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: 'adopt' + cache: sbt + - uses: sbt/setup-sbt@v1 + - run: sbt ci-release + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} \ No newline at end of file diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index a4ba01f5..048bf200 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -12,12 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 11 distribution: 'adopt' + - uses: sbt/setup-sbt@v1 - name: Run tests run: sbt ++2.12.18 test @@ -26,12 +27,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 11 distribution: 'adopt' + - uses: sbt/setup-sbt@v1 - name: Run tests run: sbt ++2.13.12 test @@ -42,9 +44,10 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 11 distribution: 'adopt' + - uses: sbt/setup-sbt@v1 - name: Run tests run: sbt ++3.3.0 test diff --git a/build.sbt b/build.sbt index addec8f4..adf5c310 100644 --- a/build.sbt +++ b/build.sbt @@ -62,4 +62,22 @@ def crossScalaSettings = { } } ) -} \ No newline at end of file +} + +inThisBuild( + List( + organization := "org.scalamock", + homepage := Some(url("http://scalamock.org/")), + licenses := List( + "MIT" -> url("https://opensource.org/licenses/MIT") + ), + developers := List( + Developer("paulbutcher", "Paul Butcher", "", url("http://paulbutcher.com/")), + Developer("barkhorn", "Philipp Meyerhoefer", "", url("https://github.com/barkhorn")), + Developer("goshacodes", "Georgii Kovalev", "", url("https://github.com/goshacodes")) + ), + sonatypeCredentialHost := "s01.oss.sonatype.org" + ) +) + +sonatypeRepository := "https://s01.oss.sonatype.org/service/local" \ No newline at end of file diff --git a/project/build.properties b/project/build.properties index abbbce5d..73df629a 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.8 +sbt.version=1.10.7 diff --git a/project/plugins.sbt b/project/plugins.sbt index b26f0b4b..9994158d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ - +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0") diff --git a/publishing.sbt b/publishing.sbt deleted file mode 100644 index 4d939aad..00000000 --- a/publishing.sbt +++ /dev/null @@ -1,37 +0,0 @@ -ThisBuild / organization := "org.scalamock" -ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) -ThisBuild / scmInfo := Some( - ScmInfo(url("https://github.com/paulbutcher/ScalaMock"), "scm:git:git@github.com:paulbutcher/ScalaMock.git") -) -ThisBuild / developers := List( - Developer("paulbutcher", "Paul Butcher", "", url("http://paulbutcher.com/")), - Developer("barkhorn", "Philipp Meyerhoefer", "", url("https://github.com/barkhorn")) -) -ThisBuild / homepage := Some(url("http://scalamock.org/")) -//ThisBuild / pomIncludeRepository := { _ => false } - -ThisBuild / version := { - val Snapshot = """(\d+)\.(\d+)\.(\d+)-\d+.*?""".r - git.gitDescribedVersion.value.getOrElse("0.0.0-1")match { - case Snapshot(maj, min, _) => s"$maj.${min.toInt + 1}.0-SNAPSHOT" - case v => v - } -} - -ThisBuild / isSnapshot := version.value.endsWith("-SNAPSHOT") - -ThisBuild / publishTo := { - if (isSnapshot.value) Opts.resolver.sonatypeOssSnapshots.headOption else Some(Opts.resolver.sonatypeStaging) -} -ThisBuild / publishConfiguration := publishConfiguration.value.withOverwrite(true) -ThisBuild / publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true) - -addCommandAlias("ci-all", ";+clean ;+compile ;+test ;+package") -addCommandAlias("release", ";+scalamockJVM/publishSigned ;+scalamockJS/publishSigned ;sonatypeReleaseAll") - -credentials ++= ( - for { - u <- Option(System.getenv().get("SONATYPE_USERNAME")) - p <- Option(System.getenv().get("SONATYPE_PASSWORD")) - } yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", u, p) - ).toSeq