Skip to content

Commit

Permalink
build: Publish snapshots (#1219)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw authored Nov 2, 2023
1 parent f0ee10c commit ff5fd4b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 40 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,27 @@ 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/[email protected]
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: 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/[email protected]

- name: Set up JDK 17
uses: coursier/[email protected]
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 }}
1 change: 0 additions & 1 deletion integration-test/kubernetes-dns/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ dockerCommands ++= Seq(
Cmd("USER", "root"),
Cmd("RUN", "chgrp -R 0 . && chmod -R g=u .")
)

1 change: 0 additions & 1 deletion integration-test/rollingupdate-kubernetes/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

enablePlugins(JavaAppPackaging, DockerPlugin)

resolvers += "Akka library repository".at("https://repo.akka.io/maven")
Expand Down
4 changes: 2 additions & 2 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
26 changes: 14 additions & 12 deletions project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,7 +22,7 @@ object NoPublish extends AutoPlugin {
publish / skip := true,
publishArtifact := false,
publish := {},
publishLocal := {},
publishLocal := {}
)
}

Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions project/project-info.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ff5fd4b

Please sign in to comment.