From 183f9a536c2b88c4f71cd8b5c2c903f1cc3177ec Mon Sep 17 00:00:00 2001 From: david Date: Tue, 24 Dec 2024 18:31:01 +0100 Subject: [PATCH] Add Maven publishing configuration to build script Integrated the `maven-publish` plugin and configured the `publishing` block to enable artifact publication. Publications are set up for snapshots or releases based on the version, with credentials sourced from environment variables. --- api/build.gradle.kts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index f209e78..602f1d7 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("java") + id("maven-publish") } group = rootProject.group @@ -27,3 +28,17 @@ dependencies { annotationProcessor("org.projectlombok:lombok:1.18.36") } + +publishing { + publications.create("maven") { + from(components["java"]) + } + repositories.maven { + val channel = if ((version as String).contains("-pre")) "snapshots" else "releases" + url = uri("https://repo.thenextlvl.net/$channel") + credentials { + username = System.getenv("REPOSITORY_USER") + password = System.getenv("REPOSITORY_TOKEN") + } + } +} \ No newline at end of file