Skip to content

Commit

Permalink
调整 maven-publish 脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
leavesCZY committed Oct 26, 2023
1 parent 597498c commit de8facf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 39 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ androidx-lifecycle-runtime-ktx = "2.6.2"
compose-bom = "2023.10.01"
compose-compiler = "1.5.3"

matisse = "0.0.1-test03"
matisse = "1.1.1"

coil = "2.4.0"
glide = "1.0.0-beta01"
Expand Down
100 changes: 62 additions & 38 deletions matisse/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,56 +41,80 @@ android {
}
}

publishing {
publications {
create<MavenPublication>("release") {
groupId = "io.github.leavesczy"
artifactId = "matisse"
version = "0.0.1-test03"
afterEvaluate {
from(components["release"])
}
pom {
name = "Matisse"
description = "A Image/Video Selector Implemented with Jetpack Compose"
url = "https://github.com/leavesCZY/Matisse"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
val signingKeyId = properties["signing.keyId"]?.toString()
val signingPassword = properties["signing.password"]?.toString()
val signingSecretKeyRingFile = properties["signing.secretKeyRingFile"]?.toString()
val mavenCentralUserName = properties["mavenCentral.username"]?.toString()
val mavenCentralEmail = properties["mavenCentral.email"]?.toString()
val mavenCentralPassword = properties["mavenCentral.password"]?.toString()

if (signingKeyId != null
&& signingPassword != null
&& signingSecretKeyRingFile != null
&& mavenCentralUserName != null
&& mavenCentralEmail != null
&& mavenCentralPassword != null
) {
publishing {
publications {
create<MavenPublication>("release") {
groupId = "io.github.leavesczy"
artifactId = "matisse"
version = "1.1.1"
afterEvaluate {
from(components["release"])
}
developers {
developer {
id = "leavesCZY"
name = "leavesCZY"
email = properties.getting("ossrh.email")
pom {
name = "Matisse"
description = "A Image/Video Selector Implemented with Jetpack Compose"
url = "https://github.com/leavesCZY/Matisse"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "leavesCZY"
name = "leavesCZY"
email = mavenCentralEmail
}
}
scm {
url = "https://github.com/leavesCZY/Matisse"
connection = "https://github.com/leavesCZY/Matisse"
developerConnection = "https://github.com/leavesCZY/Matisse"
}
}
scm {
url = "https://github.com/leavesCZY/Matisse"
connection = "https://github.com/leavesCZY/Matisse"
developerConnection = "https://github.com/leavesCZY/Matisse"
}
}
repositories {
maven {
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = mavenCentralUserName
password = mavenCentralPassword
}
}
}
}
repositories {
maven {
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = properties["ossrh.username"].toString()
password = properties["ossrh.password"].toString()
signing {
sign(publishing.publications["release"])
}
} else {
publishing {
publications {
create<MavenPublication>("release") {
afterEvaluate {
from(components["release"])
}
}
}
}
}

signing {
sign(publishing.publications["release"])
}

dependencies {
testImplementation(libs.test.junit)
androidTestImplementation(libs.test.androidx.junit)
Expand Down

0 comments on commit de8facf

Please sign in to comment.