diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1abe356be..44eb736d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,69 +1,22 @@ name: release - on: - workflow_dispatch: - inputs: - version: - description: "The release version" - required: true - branch: - description: "The branch to release from" - required: true - default: 'master' - + push: + branches: [master] + tags: ["*"] jobs: - release: + publish: runs-on: ubuntu-latest steps: - - name: checkout the repo - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Set up JDK - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: + distribution: temurin java-version: 11 - - - name: Launch elastic docker - run: docker run -d -it -p 39227:9200 -p 39337:9300 -e "discovery.type=single-node" -v /home/runner/work/elastic4s/elastic4s/elastic4s-tests/src/test/resources/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:8.12.2 - - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.PGP_PASSPHRASE }} - - - name: GPG user IDs - run: | - echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}" - echo "keyid: ${{ steps.import_gpg.outputs.keyid }}" - echo "name: ${{ steps.import_gpg.outputs.name }}" - echo "email: ${{ steps.import_gpg.outputs.email }}" - - - name: publish 2.12 release - run: sbt ++2.12.12 publishSigned - env: - RELEASE_VERSION: ${{ github.event.inputs.version }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - - - name: publish 2.13 release - run: sbt ++2.13.4 publishSigned - env: - RELEASE_VERSION: ${{ github.event.inputs.version }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - - - name: publish 3.0 release - run: sbt ++3.3.0 elastic4s-scala3/publishSigned + - run: sbt ci-release env: - RELEASE_VERSION: ${{ github.event.inputs.version }} - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - - - name: tag release - run: | - git tag v${{ github.event.inputs.version }} - git push --tags + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/build.sbt b/build.sbt index 3c283fbce..2e7266e0f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,5 @@ import Dependencies._ -ThisBuild / organizationName := "com.sksamuel.elastic4s" - // Required due to dependency conflict in SBT // See https://github.com/sbt/sbt/issues/6997 ThisBuild / libraryDependencySchemes ++= Seq( @@ -14,17 +12,9 @@ def isGithubActions = sys.env.getOrElse("CI", "false") == "true" def releaseVersion: String = sys.env.getOrElse("RELEASE_VERSION", "") def isRelease = releaseVersion != "" -// the version to use to publish - either from release version or a snapshot run number -def publishVersion = if (isRelease) releaseVersion else "8.6.0." + githubRunNumber + "-SNAPSHOT" - // set by github actions and used as the snapshot build number def githubRunNumber = sys.env.getOrElse("GITHUB_RUN_NUMBER", "local") -// creds for release to maven central -def ossrhUsername = sys.env.getOrElse("OSSRH_USERNAME", "") -def ossrhPassword = sys.env.getOrElse("OSSRH_PASSWORD", "") - - val scala2Versions = Seq("2.12.19", "2.13.14") val scalaAllVersions = scala2Versions :+ "3.3.3" @@ -42,8 +32,7 @@ lazy val warnUnusedImport = Seq( ) lazy val commonSettings = Seq( - organization := "com.sksamuel.elastic4s", - version := publishVersion, + organization := "nl.gn0s1s", resolvers ++= Seq(Resolver.mavenLocal), Test / parallelExecution := false, Compile / doc / scalacOptions := (Compile / doc / scalacOptions).value.filter(_ != "-Xfatal-warnings"), @@ -51,18 +40,7 @@ lazy val commonSettings = Seq( ) lazy val publishSettings = Seq( - publishMavenStyle := true, - Test / publishArtifact := false, - pomIncludeRepository := Function.const(false), - releaseCrossBuild := true, - releasePublishArtifactsAction := PgpKeys.publishSigned.value, - publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isRelease) - Some("releases" at nexus + "service/local/staging/deploy/maven2") - else - Some("snapshots" at nexus + "content/repositories/snapshots") - } + Test / publishArtifact := false ) lazy val commonJvmSettings = Seq( @@ -76,28 +54,24 @@ lazy val commonJvmSettings = Seq( javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:+CMSClassUnloadingEnabled"), ) - lazy val pomSettings = Seq( - homepage := Some(url("https://github.com/sksamuel/elastic4s")), - licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0")), - scmInfo := Some(ScmInfo(url("https://github.com/sksamuel/elastic4s"), "scm:git:git@github.com:sksamuel/elastic4s.git")), - apiURL := Some(url("http://github.com/sksamuel/elastic4s/")), - pomExtra := - - sksamuel - Sam Samuel - https://github.com/sksamuel - - -) - -lazy val credentialSettings = Seq( - credentials := Seq(Credentials( - "Sonatype Nexus Repository Manager", - "oss.sonatype.org", - sys.env.getOrElse("OSSRH_USERNAME", ""), - sys.env.getOrElse("OSSRH_PASSWORD", "") - )) + startYear := Some(2013), + homepage := Some(url("https://github.com/philippus/elastic4s")), + licenses += License.Apache2, + developers := List( + Developer( + id = "Philippus", + name = "Philippus Baalman", + email = "", + url = url("https://github.com/philippus") + ), + Developer( + id = "sksamuel", + name = "Samuel", + email = "", + url = url("https://github.com/sksamuel") + ) + ) ) lazy val noPublishSettings = Seq( @@ -111,7 +85,6 @@ lazy val allSettings = commonScalaVersionSettings ++ commonJvmSettings ++ commonSettings ++ commonDeps ++ - credentialSettings ++ pomSettings ++ warnUnusedImport ++ publishSettings diff --git a/project/plugins.sbt b/project/plugins.sbt index 0a8530ddd..82cb2620f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1 @@ -resolvers += Classpaths.sbtPluginReleases - -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") - -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") diff --git a/version.sbt b/version.sbt index 43bdc6162..4f5d47f80 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -ThisBuild / version := "7.9.3-SNAPSHOT" +ThisBuild / version := "8.12.0-SNPSHOT"