Skip to content

Commit

Permalink
remove nexus publishing plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarken committed Jun 2, 2024
1 parent 15bec2a commit b9f2770
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
15 changes: 0 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.nexusPlugin)
}

apply(from = "$rootDir/scripts/versioning.gradle.kts")
Expand All @@ -20,17 +19,3 @@ rootProject.extra.apply {
set("signingKeyBase64", System.getenv("SIGNING_KEY_BASE64") ?: "")
set("signingPassword", System.getenv("SIGNING_PASSWORD") ?: "")
}

val ossrhUsername: String by extra
val ossrhPassword: String by extra

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
19 changes: 17 additions & 2 deletions scripts/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

group = POM_GROUP_ID
version = POM_VERSION
def getReleaseRepositoryUrl() {
return 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
}

def getSnapshotRepositoryUrl() {
return 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}

afterEvaluate {
publishing {
Expand Down Expand Up @@ -38,6 +43,16 @@ afterEvaluate {
}
}
}

repositories {
maven {
url = rootProject.ext["isReleaseVersion"] ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl()
credentials {
username = rootProject.ext["ossrhUsername"]
password = rootProject.ext["ossrhPassword"]
}
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ git diff --quiet && clean=true || clean=false
if [ "$clean" = true ] && [ ! -z "$(git describe --exact-match --tags 2>/dev/null)" ];
then
echo "Releasing to maven central..."
./gradlew publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
else
echo "Publishing to sonatype staging repository without releasing..."
./gradlew publishReleasePublicationToSonatypeRepository closeSonatypeStagingRepository
fi

./gradlew publish
2 changes: 2 additions & 0 deletions scripts/versioning.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ val gitBranch = GitCommand("rev-parse", "--abbrev-ref", "HEAD")

val isReleaseVersion = gitTag.isNotEmpty() && gitStatus.isEmpty()

rootProject.extra["isReleaseVersion"] = isReleaseVersion

rootProject.extra["buildVersionName"] = run {
if (isReleaseVersion) {
gitTag.substring(1)
Expand Down

0 comments on commit b9f2770

Please sign in to comment.