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
36 changes: 21 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,39 @@ on:
types: [published]
workflow_dispatch:

env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY: ${{ secrets.OSSRH_SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
- name: Checkout Application Repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Build with Gradle
uses: gradle/gradle-build-action@cd3cedc781988c804f626f4cd2dc51d0bdf02a12
with:
arguments: build -x check
- name: Publish
uses: gradle/gradle-build-action@cd3cedc781988c804f626f4cd2dc51d0bdf02a12
with:
arguments: publish

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Publish to Maven Central
run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --stacktrace --no-configuration-cache
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_SIGNING_KEY: ${{ secrets.OSSRH_SIGNING_KEY }}
OSSRH_SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY: ${{ secrets.OSSRH_SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
4 changes: 3 additions & 1 deletion build-logic/conventions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
plugins {
`kotlin-dsl`
id("com.vanniktech.maven.publish.base") version "0.31.0" apply false
}

repositories {
mavenCentral()
}

dependencies {
compileOnly("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin:0.31.0")
}

gradlePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.gradle.external.javadoc.JavadocMemberLevel
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.kotlin
import org.gradle.kotlin.dsl.withType

class LibraryConventionPlugin : Plugin<Project> {
Expand All @@ -25,7 +24,8 @@ class LibraryConventionPlugin : Plugin<Project> {
val extension = project.extensions.create<InventoryFrameworkExtension>("inventoryFramework")
project.afterEvaluate {
if (extension.publish.get()) {
configureMavenPublish()
plugins.apply("com.vanniktech.maven.publish.base")
configureInventoryFrameworkPublication()
}
}
}
Expand Down
82 changes: 9 additions & 73 deletions build-logic/conventions/src/main/kotlin/Publish.kt
Original file line number Diff line number Diff line change
@@ -1,77 +1,13 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.the
import org.gradle.plugins.signing.SigningExtension

fun Project.configureMavenPublish() {
plugins.apply("maven-publish")
plugins.apply("signing")

val isReleaseVersion = !project.version.toString().endsWith("SNAPSHOT")

configure<PublishingExtension> {
publications {
create<MavenPublication>("javaOSSRH") {
groupId = rootProject.group.toString()
artifactId = project.name
version = rootProject.version.toString()
from(components.named("java").get())

pom {
name.set("inventory-framework")
description.set("Minecraft Inventory API framework")
url.set("https://github.com/DevNatan/inventory-framework")
inceptionYear.set("2020")

licenses {
license {
name.set("MIT License")
url.set("https://github.com/DevNatan/inventory-framework/blob/main/LICENSE")
}
}
developers {
developer {
name.set("Natan Vieira do Nascimento")
email.set("natanvnascimento@gmail.com")
url.set("https://github.com/DevNatan")
}
}
scm {
connection.set("scm:git:git:github.com/DevNatan/inventoryframework.git")
developerConnection.set("scm:git:https://github.com/DevNatan/inventoryframework.git")
url.set("https://github.com/DevNatan/inventoryframework")
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = uri(
if (isReleaseVersion)
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
else
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
)
credentials {
username = findProperty("ossrh.username") as String? ?: System.getenv("OSSRH_USERNAME")
password = findProperty("ossrh.password") as String? ?: System.getenv("OSSRH_PASSWORD")
}
}
}
}

configure<SigningExtension> {
isRequired = isReleaseVersion && gradle.taskGraph.hasTask("publish")
useInMemoryPgpKeys(
findProperty("signing.keyId") as String? ?: System.getenv("OSSRH_SIGNING_KEY"),
findProperty("signing.password") as String? ?: System.getenv("OSSRH_SIGNING_PASSWORD")
)

sign(the<PublishingExtension>().publications.named("javaOSSRH").get())
fun Project.configureInventoryFrameworkPublication() {
extensions.configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
pomFromGradleProperties()
configureBasedOnAppliedPlugins()
}
}
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.spotless) apply false
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.publish) apply false
}

group = "me.devnatan"
Expand Down
24 changes: 20 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
kotlin.incremental=true
kotlin.jvm.target=21
kotlin.compiler.execution.strategy=daemon
kotlin.compiler.execution.strategy=daemon
mavenCentralUsername=hF0LIjUb
mavenCentralPassword=YyOxPjtftSzmgN8sYNuS0beTp7Z916E6tB3Fhg8ftgIm
Comment on lines +5 to +6
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know.. Purposeful.


### Publication ###
POM_NAME=inventory-framework
POM_DESCRIPTION=Minecraft Inventory API framework
POM_URL=https://github.com/DevNatan/inventory-framework
POM_INCEPTION_YEAR=2020
POM_SCM_URL=https://github.com/DevNatan/inventoryframework
POM_SCM_CONNECTION=scm:git:git:github.com/DevNatan/inventoryframework.git
POM_SCM_DEV_CONNECTION=scm:git:https://github.com/DevNatan/inventoryframework.git
POM_LICENCE_NAME=MIT License
POM_LICENSE_URL=https://github.com/DevNatan/inventory-framework/blob/main/LICENSE
POM_DEVELOPER_ID=DevNatan
POM_DEVELOPER_NAME=Natan Vieira do Nascimento
POM_DEVELOPER_URL=natanvnascimento@gmail.com
POM_DEVELOPER_EMAIL=https://github.com/DevNatan
SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ shadowjar = { id = "com.gradleup.shadow", version.ref = "plugin-shadowjar" }
spotless = { id = "com.diffplug.spotless", version.ref = "plugin-spotless" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
bukkit = { id = "de.eldoria.plugin-yml.bukkit", version.ref = "plugin-bukkit" }
run-paper = { id = "xyz.jpenilla.run-paper", version = "2.3.1" }
run-paper = { id = "xyz.jpenilla.run-paper", version = "2.3.1" }
publish = { id = "com.vanniktech.maven.publish.base", version = "0.31.0" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion inventory-framework-anvil-input/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("me.devnatan.inventoryframework.library")
alias(libs.plugins.kotlin)
id("me.devnatan.inventoryframework.library")
}

inventoryFramework {
Expand Down
8 changes: 4 additions & 4 deletions inventory-framework-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ plugins {
alias(libs.plugins.kotlin)
}

dependencies {
compileOnly(libs.adventure.api)
}

inventoryFramework {
publish = true
}

dependencies {
compileOnly(libs.adventure.api)
}

kotlin {
explicitApi()
jvmToolchain(8)
Expand Down
3 changes: 3 additions & 0 deletions inventory-framework-platform-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar

plugins {
id("me.devnatan.inventoryframework.library")
alias(libs.plugins.shadowjar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

public final class InventoryFramework extends JavaPlugin {

public static final String LIBRARY_VERSION = "3.3.0";
public static final String LIBRARY_VERSION = String.join(".", "3", "3", "0");
}
4 changes: 0 additions & 4 deletions inventory-framework-platform-minestom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ plugins {
alias(libs.plugins.shadowjar)
}

inventoryFramework {
publish = true
}

dependencies {
api(projects.inventoryFrameworkPlatform)
compileOnly(libs.minestom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class GlobalClickInterceptor : PipelineInterceptor<VirtualView> {

// inherit cancellation so we can un-cancel it
subject.isCancelled =
event.isCancelled || subject.config.isOptionSet(ViewConfig.CANCEL_ON_CLICK, true)
event.isCancelled ||
subject.config.isOptionSet(ViewConfig.CANCEL_ON_CLICK, true)
subject.root.onClick(subject)
}
}
Loading