Skip to content

Commit

Permalink
build: Publish snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw committed Nov 2, 2023
1 parent 0197caa commit f741de4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 48 deletions.
33 changes: 9 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
jobs:
release:
# runs on main repo only
if: github.repository == 'akka/akka-persistence-jdbc'
if: github.event.repository.fork == false
name: Release
# the release environment provides access to secrets required in the release process
# https://github.com/akka/akka-persistence-jdbc/settings/environments/164872635/edit
Expand Down Expand Up @@ -48,42 +48,27 @@ jobs:
run: sbt +publishSigned

documentation:
# runs on main repo only
if: github.repository == 'akka/akka-persistence-jdbc'
name: Documentation
# the release environment provides access to secrets required in the release process
# https://github.com/akka/akka-persistence-jdbc/settings/environments/164872635/edit
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 11
uses: coursier/[email protected]
with:
jvm: temurin:1.11.0
jvm: temurin:1.11

- 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 }}
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 Akka Projection are provided via the Sonatype snapshot repository.
project.description: Snapshot builds via the Sonatype snapshot repository.
---
# Snapshots

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

Snapshots are published to the Sonatype Snapshot repository after every successful build on master.
Snapshots are published to https://repo.akka.io/snapshots repository after every successful build on master.
Add the following to your project build definition to resolve Akka Persistence JDBC's 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/akka-persistence-jdbc/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 Akka Projection files](https://oss.sonatype.org/content/repositories/snapshots/com/lightbend/akka/akka-persistence-jdbc_2.13/) to see what versions are currently available.
11 changes: 6 additions & 5 deletions project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ object Publish extends AutoPlugin {
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)))
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

0 comments on commit f741de4

Please sign in to comment.