Skip to content

Commit

Permalink
Add settings for publishing to OSSRH
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticfall committed Oct 16, 2021
1 parent 8ea0695 commit 1cafb03
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ which can be used to unit test React components in a Kotlin/JS project.

### Installation

_(TBA) The project will be published to Maven Central soon._
With Gradle (using Kotlin DSL):
```kotlin
implementation("io.github.mysticfall:kotlin-react-test:1.0")
```

Alternatively, using Groovy DSL:

```groovy
implementation "io.github.mysticfall:kotlin-react-test:1.0"
```

### Code Example

Expand Down
73 changes: 73 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import org.gradle.api.artifacts.repositories.PasswordCredentials

plugins {
kotlin("js") version "1.5.31"

id("maven-publish")

signing
}

group = "io.github.mysticfall"
version = "1.0-SNAPSHOT"

val isReleasedVersion = !project.version.toString().endsWith("-SNAPSHOT")

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -41,3 +49,68 @@ kotlin {
}
}
}

publishing {
publications {
create<MavenPublication>("main") {
from(components["kotlin"])

artifact(tasks.getByName<Zip>("jsSourcesJar"))

pom {
name.set("Kotlin API for React Test Renderer")
description.set(
"Kotlin wrapper for React Test Renderer, which can be used " +
"to unit test React components in a Kotlin/JS project."
)
url.set("https://github.com/mysticfall/kotlin-react-test")

licenses {
license {
name.set("The MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}

developers {
developer {
id.set("mysticfall")
name.set("Xavier Cho")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:git://github.com/mysticfall/kotlin-react-test.git")
developerConnection.set("scm:git:[email protected]:mysticfall/kotlin-react-test.git")
url.set("https://github.com/mysticfall/kotlin-react-test")
}
}
}
}

repositories {
maven {
name = "ossrh"
url = uri(
if (isReleasedVersion) {
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
)

credentials(PasswordCredentials::class)
}
}
}

signing {
// setRequired({
// gradle.taskGraph.hasTask("publish")
// })

useGpgCmd()

sign(publishing.publications)
}

0 comments on commit 1cafb03

Please sign in to comment.