Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Migrate to new Gradle Nexus Publish Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
svenjacobs committed May 7, 2021
1 parent 36f4031 commit 132543e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Deploy
if: github.ref == 'refs/heads/main'
run: ./gradlew publishToSonatype closeAndReleaseRepository
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
Expand Down
22 changes: 17 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {

plugins {
id("com.github.ben-manes.versions") version Versions.gradleVersionsPlugin
id("io.codearte.nexus-staging")
id("io.github.gradle-nexus.publish-plugin") version Versions.gradleNexusPublishPlugin
}

allprojects {
Expand All @@ -39,8 +39,20 @@ tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
}
}

nexusStaging {
packageGroup = "org.rewedigital"
username = project.findProperty("SONATYPE_NEXUS_USERNAME")?.toString() ?: System.getenv("SONATYPE_NEXUS_USERNAME")
password = project.findProperty("SONATYPE_NEXUS_PASSWORD")?.toString() ?: System.getenv("SONATYPE_NEXUS_PASSWORD")
group = "org.rewedigital.katana"
version = Version.version

nexusPublishing {
repositories {
sonatype {
username.set(
project.findProperty("SONATYPE_NEXUS_USERNAME")?.toString()
?: System.getenv("SONATYPE_NEXUS_USERNAME")
)
password.set(
project.findProperty("SONATYPE_NEXUS_PASSWORD")?.toString()
?: System.getenv("SONATYPE_NEXUS_PASSWORD")
)
}
}
}
2 changes: 0 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ dependencies {
implementation("com.android.tools.build:gradle:4.2.0")
implementation("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
implementation("de.marcphilipp.gradle:nexus-publish-plugin:0.4.0")
implementation("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0")
}
18 changes: 0 additions & 18 deletions buildSrc/src/main/kotlin/BaseProject.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@file:Suppress("UnstableApiUsage")

import de.marcphilipp.gradle.nexus.NexusPublishExtension
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
Expand All @@ -18,7 +17,6 @@ fun Project.configureBase(
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.gradle.maven-publish")
apply(plugin = "org.gradle.signing")
apply(plugin = "de.marcphilipp.nexus-publish")

dependencies {
"api"(kotlin(module = "stdlib", version = Versions.kotlin))
Expand Down Expand Up @@ -96,20 +94,4 @@ fun Project.configureBase(
sign(pub.publications[artifactName])
}
}

configure<NexusPublishExtension> {
repositories {
sonatype {
packageGroup.set("org.rewedigital")
username.set(
project.findProperty("SONATYPE_NEXUS_USERNAME")?.toString()
?: System.getenv("SONATYPE_NEXUS_USERNAME")
)
password.set(
project.findProperty("SONATYPE_NEXUS_PASSWORD")?.toString()
?: System.getenv("SONATYPE_NEXUS_PASSWORD")
)
}
}
}
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ object Versions {
const val androidXFragment = "1.3.3"
const val androidXLifecycle = "2.3.1"
const val gradleVersionsPlugin = "0.38.0"
const val gradleNexusPublishPlugin = "1.1.0"
const val kluent = "1.65"
const val kotlin = "1.5.0"
const val spek = "2.0.15"
Expand Down

0 comments on commit 132543e

Please sign in to comment.