Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,27 @@ jobs:
strategy:
matrix:
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
java-versions: ['8', '11', '17', '21']
versions: [
{ java: '11', gradle: '8.14.3' },
{ java: '17', gradle: 'current' },
{ java: '21', gradle: 'current' },
{ java: '25', gradle: 'current' },
]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java ${{ matrix.java-versions }}
- name: Set up Java ${{ matrix.versions.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-versions }}
java-version: ${{ matrix.versions.java }}
distribution: 'temurin'
cache: 'gradle'

- name: Build & Test
uses: gradle/gradle-build-action@v3
- name: Setup Gradle ${{ matrix.versions.gradle }}
uses: gradle/actions/setup-gradle@v5
with:
arguments: build test
gradle-version: ${{ matrix.versions.gradle }}

- name: Build & Test
run: gradle build test --stacktrace
31 changes: 31 additions & 0 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish to Maven Central

on:
push:
tags:
- v*

jobs:
publish:
name: Publish release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Publish library to Maven Central
run: ./gradlew :publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
86 changes: 44 additions & 42 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import com.vanniktech.maven.publish.SonatypeHost

plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
Expand All @@ -7,7 +8,9 @@ plugins {

// Apply the java-library plugin for API and implementation separation.
`java-library`
`maven-publish`

// maven publishing
id("com.vanniktech.maven.publish") version "0.29.0"
}

// from: https://discuss.kotlinlang.org/t/use-git-hash-as-version-number-in-build-gradle-kts/19818/8
Expand Down Expand Up @@ -75,51 +78,50 @@ java {
}

// Javadocs
val javadocJar = tasks.named<Jar>("javadocJar") {
from(tasks.named("dokkaJavadoc"))
}
// val javadocJar = tasks.named<Jar>("javadocJar") {
// from(tasks.named("dokkaJavadoc"))
// }


mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

signAllPublications()

coordinates(finalGroup, artifact, finalVersion)

pom {
name.set("TCGdex SDK")
description.set("Communicate with the Open Source TCGdex API in Kotlin/Java using the SDK")
url.set("https://github.com/tcgdex/java-sdk")
inceptionYear.set("2022")

publishing {
publications {
create<MavenPublication>("maven") {
groupId = finalGroup
artifactId = artifact
version = finalVersion

from(components["java"])

pom {
name.set("TCGdex SDK")
description.set("Communicate with the Open Source TCGdex API in Kotlin/Java using the SDK")
url.set("https://github.com/tcgdex/java-sdk")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/tcgdex/java-sdk/blob/master/LICENSE.txt")
}
}
developers {
developer {
id.set("avior")
name.set("Avior")
email.set("contact@tcgdex.net")
}
}
scm {
connection.set("scm:git@github.com:tcgdex/java-sdk.git")
url.set("https://github.com/tcgdex/java-sdk")
}
licenses {
license {
name.set("MIT License")
url.set("https://github.com/tcgdex/java-sdk/blob/master/LICENSE.md")
distribution.set("repo")
}
}
}
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/tcgdex/java-sdk")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")

developers {
developer {
id.set("avior")
name.set("Avior")
email.set("contact@dze.io")
url.set("https://github.com/Aviortheking")
}
}

scm {
url.set("https://github.com/tcgdex/java-sdk")
connection.set("scm:git:git://github.com/tcgdex/java-sdk.git")
developerConnection.set("scm:git:ssh://git@github.com/tcgdex/java-sdk.git")
}

issueManagement {
system.set("GitHub Issues")
url.set("https://github.com/tcgdex/java-sdk/issues")
}
}
}
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Mar 11 13:36:49 CET 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading