From 517dc6204cfc27e8cbd0d89d4da5ebebcd4112da Mon Sep 17 00:00:00 2001 From: david Date: Sun, 1 Sep 2024 20:03:14 +0200 Subject: [PATCH] [ci skip] Add Maven publish plugin configuration Integrate the Maven publish plugin to build.gradle.kts for publishing artifacts. Configure script to handle snapshots and releases based on version, and set up repository credentials using environment variables. --- build.gradle.kts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 94c2963..46bc1da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("java") + id("maven-publish") } group = "net.thenextlvl.resolver" @@ -37,4 +38,18 @@ dependencies { tasks.test { useJUnitPlatform() +} + +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