From ebdc03b0b4680a8fa90d34b0292a1ae9bda8d835 Mon Sep 17 00:00:00 2001 From: Josh Chester Date: Sat, 24 Jan 2026 00:37:54 -0600 Subject: [PATCH] Add publish step --- .gitea/workflows/build.yml | 3 ++- build.gradle.kts | 53 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 416d099..b9e0f01 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -15,4 +15,5 @@ jobs: # cache-dependency-path: | # optional # sub-project/*.gradle* # sub-project/**/gradle-wrapper.properties - - run: ./gradlew build --no-daemon \ No newline at end of file + - run: ./gradlew build --no-daemon + - run: ./gradlew publishAllPublicationsToGiteaRepository -PgradleKey="${{ secrets.GRADLE_KEY }}" \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7588752..df1cd1e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,65 @@ plugins { id("java") + `maven-publish` + // Also commonly used for creating source/javadoc JARs + id("org.jetbrains.dokka") version "1.9.20" } group = "com.softwaresmyth" version = "1.0-SNAPSHOT" +val mySecret = project.findProperty("mySecretProperty") + +publishing { + // Define a publication, in this case for Maven + publications { + // other settings of publication + repositories { + maven { + name = "Gitea" + url = uri("https://gitea.example.com/api/packages/numbers/maven") + + credentials(HttpHeaderCredentials::class) { + name = "Authorization" + value = "token $mySecret" + } + + authentication { + create("header") + } + } + } + + create("Smythery") { + // Specify which component to publish (usually "java" for a standard library) + from(components["java"]) + + // Optional: Customize POM metadata (required for Maven Central) + pom { + name = "Ornot" + description = "A library of methods that do nothing" + url = "https://gitea.softwaresmyth.com/numbers/Ornot" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + id = "Numbers" + name = "Josh Chester" + } + } + } + } + } +} + repositories { mavenCentral() + // other repositories + maven { url = uri("https://gitea.softwaresmyth.com/api/packages/numbers/maven") } } dependencies {