diff --git a/.github/workflows/deploy-release.yaml b/.github/workflows/deploy-release.yaml index bd101611..8fade122 100644 --- a/.github/workflows/deploy-release.yaml +++ b/.github/workflows/deploy-release.yaml @@ -28,4 +28,4 @@ jobs: ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} - run: ./gradlew publishAllPublicationsToOSSRHReleaseRepository + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository diff --git a/.github/workflows/deploy-snapshot.yaml b/.github/workflows/deploy-snapshot.yaml index 89c05d83..285e9340 100644 --- a/.github/workflows/deploy-snapshot.yaml +++ b/.github/workflows/deploy-snapshot.yaml @@ -31,4 +31,4 @@ jobs: ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }} ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} - run: ./gradlew publishAllPublicationsToOSSRHSnapshotRepository + run: ./gradlew publishToSonatype diff --git a/build.gradle.kts b/build.gradle.kts index ecaf5eed..999a2814 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.android.build.api.dsl.LibraryExtension import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import org.eclipse.kuksa.version.SemanticVersion import org.eclipse.kuksa.version.VERSION_FILE_DEFAULT_NAME import org.eclipse.kuksa.version.VERSION_FILE_DEFAULT_PATH_KEY import java.nio.file.FileVisitResult @@ -34,6 +35,9 @@ import kotlin.io.path.visitFileTree val versionDefaultPath = "$rootDir/$VERSION_FILE_DEFAULT_NAME" rootProject.ext[VERSION_FILE_DEFAULT_PATH_KEY] = versionDefaultPath +val semanticVersion = SemanticVersion(versionDefaultPath) +version = semanticVersion.versionName +group = "org.eclipse.velocitas" plugins { base @@ -41,6 +45,16 @@ plugins { version kotlin("jvm") jacoco + alias(libs.plugins.gradle.nexus.publish.plugin) +} + +nexusPublishing { + repositories { + sonatype { + username = System.getenv("ORG_OSSRH_USERNAME") + password = System.getenv("ORG_OSSRH_PASSWORD") + } + } } subprojects { diff --git a/buildSrc/src/main/kotlin/publish.gradle.kts b/buildSrc/src/main/kotlin/publish.gradle.kts index efb71751..a9a2bee5 100644 --- a/buildSrc/src/main/kotlin/publish.gradle.kts +++ b/buildSrc/src/main/kotlin/publish.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ plugins { } interface PublishPluginExtension { + val artifactGroup: Property + val artifactName: Property + val artifactVersion: Property val mavenPublicationName: Property val componentName: Property val description: Property @@ -32,26 +35,6 @@ val extension = project.extensions.create("publish") afterEvaluate { publishing { - repositories { - maven { - name = "OSSRHRelease" - - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = System.getenv("ORG_OSSRH_USERNAME") - password = System.getenv("ORG_OSSRH_PASSWORD") - } - } - maven { - name = "OSSRHSnapshot" - - url = uri("https://oss.sonatype.org/content/repositories/snapshots/") - credentials { - username = System.getenv("ORG_OSSRH_USERNAME") - password = System.getenv("ORG_OSSRH_PASSWORD") - } - } - } publications { register(extension.mavenPublicationName.get()) { from(components[extension.componentName.get()]) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 365dbaa2..1f826581 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -58,3 +58,4 @@ detekt-gradlePlugin = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gr detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" } [plugins] +gradle-nexus-publish-plugin = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }