Skip to content

Commit

Permalink
build: Publish snapshots (#1689)
Browse files Browse the repository at this point in the history
* build: Publish snapshots

* link checker
  • Loading branch information
patriknw authored Nov 8, 2023
1 parent 75c427a commit 6650218
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 50 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,27 @@ jobs:
run: sbt +publishSigned

documentation:
# runs on main repo only
if: github.event.repository.fork == false
name: Documentation
# the release environment provides access to secrets required in the release process
# https://github.com/akka/alpakka-kafka/settings/environments/84275678/edit
environment: release
runs-on: ubuntu-22.04
if: github.event.repository.fork == false
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
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/cache-action@v6.4.0

- name: Set up JDK 17
uses: coursier/setup-action@v1.3.0
with:
jvm: temurin:1.17.0.5

- name: Publish API and reference documentation
env:
GUSTAV_KEY: ${{ secrets.GUSTAV_KEY }}
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-add .github/id_rsa
sbt "docs/publishRsync"
sbt publishRsync
env:
AKKA_RSYNC_GUSTAV: ${{ secrets.AKKA_RSYNC_GUSTAV }}
32 changes: 13 additions & 19 deletions docs/src/main/paradox/snapshots.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
---
project.description: Snapshot builds of Alpakka Kafka are provided via the Sonatype snapshot repository.
project.description: Snapshot builds of Alpakka Kafka.
---
# Snapshots

[snapshots-badge]: https://img.shields.io/nexus/s/com.typesafe.akka/akka-stream-kafka_2.13?server=https%3A%2F%2Foss.sonatype.org
[snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/akka-stream-kafka_2.13/

Snapshots are published to the Sonatype Snapshot repository after every successful build on main.
Snapshots are published to https://repo.akka.io/snapshots repository after every successful build on main.
Add the following to your project build definition to resolve Alpakka Kafka connector snapshots:

## Configure repository
Expand All @@ -15,27 +12,29 @@ Maven
: ```xml
<project>
...
<repositories>
<repository>
<id>snapshots-repo</id>
<name>Sonatype snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<repositories>
<repositories>
<repository>
<id>akka-repository</id>
<name>Akka library snapshot repository</name>
<url>https://repo.akka.io/snapshots</url>
</repository>
</repositories>
</repositories>
...
</project>
```

sbt
: ```scala
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += "Akka library snapshot repository".at("https://repo.akka.io/snapshots")
```

Gradle
: ```gradle
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
url "https://repo.akka.io/snapshots"
}
}
```
Expand All @@ -44,8 +43,3 @@ Gradle

The [snapshot documentation](https://doc.akka.io/docs/alpakka-kafka/snapshot/) is updated with every snapshot build.

## Versions

Latest published snapshot version is [![snapshots-badge][]][snapshots]

The snapshot repository is cleaned from time to time with no further notice. Check [Sonatype snapshots Alpakka Kafka files](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/akka-stream-kafka_2.13/) to see what versions are currently available.
22 changes: 12 additions & 10 deletions project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,18 @@ object Publish extends AutoPlugin {
}
}

override def projectSettings: Seq[Def.Setting[_]] = Seq(
sonatypeProfileName := "com.typesafe",
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.typesafe",
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
3 changes: 2 additions & 1 deletion scripts/link-validator.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ site-link-validator {
# gives: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure requests
"https://javadoc.io/static/",
# The address is hit too often and blocked
"https://opensource.org/licenses/Apache-2.0"
"https://opensource.org/licenses/Apache-2.0",
"https://repo.akka.io/"
]

non-https-whitelist = [
Expand Down

0 comments on commit 6650218

Please sign in to comment.