From ff5fd4b061420ce7d07aaede4fbaf1dbd01b7b64 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 2 Nov 2023 12:33:47 +0100 Subject: [PATCH] build: Publish snapshots (#1219) --- .github/workflows/release.yml | 29 +++++-------------- integration-test/kubernetes-dns/build.sbt | 1 - .../rollingupdate-kubernetes/build.sbt | 1 - project/Common.scala | 4 +-- project/Publish.scala | 26 +++++++++-------- project/project-info.conf | 4 +-- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27798fb6c..4b976d4f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,13 +48,9 @@ jobs: run: sbt +publishSigned documentation: - # runs on main repo only - if: github.repository == 'akka/akka-management' name: Documentation - # the release environment provides access to secrets required in the release process - # https://github.com/akka/akka-management/settings/environments - environment: release runs-on: ubuntu-22.04 + if: github.event.repository.fork == false steps: - name: Checkout uses: actions/checkout@v3.1.0 @@ -62,28 +58,17 @@ jobs: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 - - name: Checkout GitHub merge - if: github.event.pull_request - run: |- - git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch - git checkout scratch - - - name: Cache Coursier cache - uses: coursier/cache-action@v6.4.0 - - name: Set up JDK 17 uses: coursier/setup-action@v1.3.0 with: jvm: temurin:1.17.0 - - name: Publish API and reference documentation - env: - GUSTAV_KEY: ${{ secrets.GUSTAV_KEY }} - GUSTAV_PASSPHRASE: ${{ secrets.GUSTAV_PASSPHRASE }} - run: |+ + - name: Publish + run: |- eval "$(ssh-agent -s)" - echo $GUSTAV_KEY | base64 -di > .github/id_rsa + echo $AKKA_RSYNC_GUSTAV | base64 -d > .github/id_rsa chmod 600 .github/id_rsa - ssh-keygen -p -P "$GUSTAV_PASSPHRASE" -N "" -f .github/id_rsa ssh-add .github/id_rsa - sbt "docs/publishRsync" + sbt publishRsync + env: + AKKA_RSYNC_GUSTAV: ${{ secrets.AKKA_RSYNC_GUSTAV }} diff --git a/integration-test/kubernetes-dns/build.sbt b/integration-test/kubernetes-dns/build.sbt index 9070592cf..637d6bdb9 100644 --- a/integration-test/kubernetes-dns/build.sbt +++ b/integration-test/kubernetes-dns/build.sbt @@ -18,4 +18,3 @@ dockerCommands ++= Seq( Cmd("USER", "root"), Cmd("RUN", "chgrp -R 0 . && chmod -R g=u .") ) - diff --git a/integration-test/rollingupdate-kubernetes/build.sbt b/integration-test/rollingupdate-kubernetes/build.sbt index e199fee20..a1b55cd22 100644 --- a/integration-test/rollingupdate-kubernetes/build.sbt +++ b/integration-test/rollingupdate-kubernetes/build.sbt @@ -1,4 +1,3 @@ - enablePlugins(JavaAppPackaging, DockerPlugin) resolvers += "Akka library repository".at("https://repo.akka.io/maven") diff --git a/project/Common.scala b/project/Common.scala index 0adb1c3ff..2349c3c2b 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -30,8 +30,8 @@ object Common extends AutoPlugin { url("https://github.com/akka/akka-management/graphs/contributors") ), releaseNotesURL := ( - if (isSnapshot.value) None - else Some(url(s"https://github.com/akka/akka-management/releases/tag/v${version.value}")) + if (isSnapshot.value) None + else Some(url(s"https://github.com/akka/akka-management/releases/tag/v${version.value}")) ), licenses := { val tagOrBranch = diff --git a/project/Publish.scala b/project/Publish.scala index 96c97b57f..33212f980 100644 --- a/project/Publish.scala +++ b/project/Publish.scala @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicBoolean import scala.language.postfixOps -import sbt.{Def, _} +import sbt.{ Def, _ } import Keys._ import com.geirsson.CiReleasePlugin import com.jsuereth.sbtpgp.PgpKeys.publishSigned @@ -22,7 +22,7 @@ object NoPublish extends AutoPlugin { publish / skip := true, publishArtifact := false, publish := {}, - publishLocal := {}, + publishLocal := {} ) } @@ -42,16 +42,18 @@ object Publish extends AutoPlugin { } } - override def projectSettings: Seq[Def.Setting[_]] = Seq( - sonatypeProfileName := "com.lightbend", - beforePublishTask := beforePublish(isSnapshot.value), - publishSigned := publishSigned.dependsOn(beforePublishTask).value, - publishTo := (if (isSnapshot.value) - Some(Resolver.file("file", target.value / "repository")) // FIXME snapshot repo - else - Some("Cloudsmith API".at("https://maven.cloudsmith.io/lightbend/akka/"))), - credentials ++= (if (isSnapshot.value) Seq[Credentials]() else cloudsmithCredentials(validate = false)) - ) + override def projectSettings: Seq[Def.Setting[_]] = + Seq( + sonatypeProfileName := "com.lightbend", + beforePublishTask := beforePublish(isSnapshot.value), + publishSigned := publishSigned.dependsOn(beforePublishTask).value, + publishTo := + (if (isSnapshot.value) + Some("Cloudsmith API".at("https://maven.cloudsmith.io/lightbend/akka-snapshots/")) + else + Some("Cloudsmith API".at("https://maven.cloudsmith.io/lightbend/akka/"))), + credentials ++= cloudsmithCredentials(validate = false) + ) def cloudsmithCredentials(validate: Boolean): Seq[Credentials] = { (sys.env.get("PUBLISH_USER"), sys.env.get("PUBLISH_PASSWORD")) match { diff --git a/project/project-info.conf b/project/project-info.conf index baa207647..9580e1846 100644 --- a/project/project-info.conf +++ b/project/project-info.conf @@ -4,8 +4,8 @@ project-info { shared-info { jdk-versions: ["Eclipse Temurin JDK 11", "Eclipse Temurin JDK 17"] snapshots: { - url: "https://oss.sonatype.org/content/repositories/snapshots/com/lightbend/akka/management/" - text: "Snapshots are available" + url: "https://repo.akka.io/snapshots" + text: "Akka library snapshot repository" } issues: { url: "https://github.com/akka/akka-management/issues"