Skip to content

Commit

Permalink
Add action for publishing sdk to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
mmodzelewski committed Oct 21, 2024
1 parent 8f437c6 commit 9247859
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish to Maven Central

on: [ workflow_dispatch ]

env:
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_PASSWORD: ${{ secrets.JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_PASSWORD }}
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME }}
JRELEASER_GIT_ROOT_SEARCH: true
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version-file: '.java-version'
distribution: 'temurin'
cache: 'gradle'
- name: Java version
run: |
java --version
- run: ./gradlew clean
- run: ./gradlew publish
- run: ./gradlew jreleaserFullRelease
67 changes: 66 additions & 1 deletion java-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
plugins {
id("java-library")
id("maven-publish")
id("org.jreleaser") version ("1.14.0")
}

group = "rs.iggy"
version = "0.0.1-SNAPSHOT"
version = "0.1.0"

repositories {
mavenCentral()
}

java {
withJavadocJar()
withSourcesJar()
}

dependencies {
implementation("org.apache.httpcomponents.client5:httpclient5:5.2.1")
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.2")
Expand All @@ -29,3 +36,61 @@ dependencies {
tasks.withType<Test> {
useJUnitPlatform()
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "iggy-java-sdk"

from(components["java"])

pom {
name = "Iggy Java Client SDK"
description = "Official Java client SDK for Iggy.rs message streaming"
url = "https://github.com/iggy-rs/iggy-java-client"
licenses {
license {
name = "MIT License"
url = "https://github.com/iggy-rs/iggy-java-client/blob/main/LICENSE"
}
}
developers {
developer {
id = "mmodzelewski"
name = "Maciej Modzelewski"
email = "[email protected]"
}
}
scm {
url = "https://github.com/iggy-rs/iggy-java-client"
connection = "scm:git:git://github.com/iggy-rs/iggy-java-client.git"
developerConnection = "scm:git:git://github.com/iggy-rs/iggy-java-client.git"
}
}
}
}

repositories {
maven {
url = uri(layout.buildDirectory.dir("staging-deploy"))
}
}
}

jreleaser {
signing {
setActive("ALWAYS")
armored = true
}
deploy {
maven {
mavenCentral {
create("sonatype") {
setActive("ALWAYS")
url = "https://central.sonatype.com/api/v1/publisher"
stagingRepository("build/staging-deploy")
}
}
}
}
}

0 comments on commit 9247859

Please sign in to comment.