Skip to content

Commit

Permalink
feat: release to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
gc-garcol committed Nov 22, 2024
1 parent 4d2d4b4 commit c394c79
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 32 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ jobs:
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0

- name: Build with Gradle
run: ./gradlew :lib-core:build
run: ./gradlew build -x test

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages and Maven Central
- name: Publish to GitHub Packages and Stage all artifacts to a local directory (for jreleaser)
run: ./gradlew :lib-core:publish
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

# For Jreleaser
- name: Publish to Maven Central
run: ./gradlew jreleaserFullRelease --stacktrace
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.JRELEASER_MAVENCENTRAL_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.TOKEN }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Developed a high-performance ring buffer leveraging `lock-free` and low-level `u

[Cafe RingBuffer Javadoc](https://gc-garcol.github.io/cafe-ringbuffer/index-all.html)

| Benchmark | Results |
|----------------------------------------------------------------------------------|--------------------------------------------------------------|
| `Unicast`-`1P – 1C` throughput: 11,200 messages. Avg-latency: 89.4 ns | <img src="readme/benchmark_unicast_1p1c.png" width="100%"/> |
| `Three Step Pipeline`-`1P – 3C` throughput: 7,800 messages.Avg-latency: 132.2 ns | <img src="readme/benchmark_pipeline_1p3c.png" width="100%"/> |
| Benchmark | Results |
|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------|
| `Unicast`-`1P – 1C` <br>throughput: 11,200,000 messages/s. <br> Avg-latency: 89.4 ns | <img src="readme/benchmark_unicast_1p1c.png" width="100%"/> |
| `Three Step Pipeline`-`1P – 3C` <br>throughput: 7,800,000 messages/s. <br>Avg-latency: 132.2 ns | <img src="readme/benchmark_pipeline_1p3c.png" width="100%"/> |
## Features

- [X] `OneToManyRingBuffer` (also configurable for `OneToOneRingBuffer` usage)
Expand Down
8 changes: 0 additions & 8 deletions README.release.md

This file was deleted.

67 changes: 66 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
import org.jreleaser.model.Active

plugins {
java
`java-library`
`maven-publish`
id("org.jreleaser") version "1.15.0"
}

group = "io.github.gc-garcol"
version = "1.0.0"

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "io.github.gc-garcol"
artifactId = "cafe-ringbuffer"

from(components["java"])

pom {
name.set("cafe-ringbuffer")
description.set("cafe-ringbuffer")
url.set("https://gc-garcol.github.io/cafe-ringbuffer/gc/garcol/libcore/package-summary.html")
inceptionYear.set("2024")
licenses {
license {
name.set("Apache-2.0")
url.set("https://spdx.org/licenses/Apache-2.0.html")
}
}
developers {
developer {
id.set("gc-garcol")
name.set("cafe")
}
}
scm {
connection.set("scm:git:https://github.com/gc-garcol/cafe-ringbuffer.git")
developerConnection.set("scm:git:ssh://github.com/gc-garcol/cafe-ringbuffer.git")
url.set("https://github.com/gc-garcol/cafe-ringbuffer/tree/main")
}
}
}
}
}

jreleaser {
signing {
active = Active.ALWAYS
armored = true
}
deploy {
maven {
mavenCentral {
create("sonatype") {
active = Active.ALWAYS
url.set("https://central.sonatype.com/api/v1/publisher")
stagingRepositories.add("lib-core/build/staging-deploy")
}
}
}
}
}
24 changes: 9 additions & 15 deletions lib-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
plugins {
`java-library`
`maven-publish`
id("org.jreleaser") version "1.15.0"
}

group = "io.github.gc-garcol"
version = "0.0.4"
version = "1.0.0"

java {
toolchain {
Expand Down Expand Up @@ -45,7 +44,7 @@ publishing {
pom {
name.set("cafe-ringbuffer")
description.set("cafe-ringbuffer")
url.set("https://github.com/gc-garcol/cafe-ringbuffer")
url.set("https://gc-garcol.github.io/cafe-ringbuffer/gc/garcol/libcore/package-summary.html")
inceptionYear.set("2024")
licenses {
license {
Expand All @@ -69,21 +68,16 @@ publishing {
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/gc-garcol/cafe-ringbuffer")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
// maven {
// name = "MavenCentral"
// url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
// name = "GitHubPackages"
// url = uri("https://maven.pkg.github.com/gc-garcol/cafe-ringbuffer")
// credentials {
// username = System.getenv("MAVEN_USERNAME")
// password = System.getenv("MAVEN_PASSWORD")
// username = System.getenv("GITHUB_ACTOR")
// password = System.getenv("GITHUB_TOKEN")
// }
// }
maven {
url = layout.buildDirectory.dir("staging-deploy").get().asFile.toURI()
}
}
}

0 comments on commit c394c79

Please sign in to comment.