Skip to content

Commit

Permalink
build: Publish snapshots (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw authored Nov 3, 2023
1 parent 84cd867 commit ad4b19f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 57 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,47 +49,27 @@ jobs:
run: sbt +publishSigned

documentation:
# runs on main repo only
if: github.repository == 'akka/akka-projection'
name: Documentation
# the release environment provides access to secrets required in the release process
# https://github.com/akka/akka-projection/settings/environments
environment: release
runs-on: ubuntu-22.04
if: github.event.repository.fork == false
steps:
- name: Checkout
# https://github.com/actions/checkout/releases
# v3.3.0
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
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
# https://github.com/coursier/cache-action/releases
# v6.4.3
uses: coursier/cache-action@d1039466d0812d6370649b9afb02bbf5f646bacf

- name: Set up JDK 11
# https://github.com/coursier/setup-action/releases
# v1.3.0
uses: coursier/setup-action@70323223454ac2a9eb2de46f389b4d045cbcdea5
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-add .github/id_rsa
sbt "docs/publishRsync; akka-distributed-cluster-docs/publishRsync; akka-edge-docs/publishRsync"
sbt publishRsync
env:
AKKA_RSYNC_GUSTAV: ${{ secrets.AKKA_RSYNC_GUSTAV }}
34 changes: 14 additions & 20 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 of Akka Projection.
---
# Snapshots

[snapshots-badge]: https://img.shields.io/nexus/s/com.lightbend.akka/akka-projection-core_2.13?server=https%3A%2F%2Foss.sonatype.org
[snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/lightbend/akka/akka-projection-core_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 Akka Projection's snapshots:

## Configure repository
Expand All @@ -15,37 +12,34 @@ 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"
}
}
```


## Documentation

The [snapshot documentation](https://doc.akka.io/docs/akka-projection/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/) to see what versions are currently available.
3 changes: 1 addition & 2 deletions project/AkkaSnapshotRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ object AkkaSnapshotRepositories extends AutoPlugin {
.get("build.akka.version")
.orElse(sys.props.get("build.alpakka.kafka.version")) match {
case Some(_) =>
// akka and alpakka-kafka use Sonatype's snapshot repo
Resolver.sonatypeOssRepos("snapshots")
Seq("Akka library snapshot repository".at("https://repo.akka.io/snapshots"))
case None => Seq.empty
})
}
Expand Down
11 changes: 6 additions & 5 deletions project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,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 ad4b19f

Please sign in to comment.