cloudstateio / kotlin-support

Cloudstate Kotlin Support
https://cloudstate.io/docs/user/lang/kotlin/index.html
Apache License 2.0
8 stars 5 forks source link

Wip publish maven #30

Closed sleipnir closed 4 years ago

ihostage commented 4 years ago

Hi, @sleipnir! I suggest using special plugins. Otherwise, need manually release projects in Sonatype. As an example, you can look at one of my repository https://github.com/taymyr/lagom-openapi

ihostage commented 4 years ago

The most interesting places:

  1. Deploy commands (.travis.yml#L34-L49)
    
    before_deploy:
    - echo $GPG_SECRET_KEYS | base64 --decode > $HOME/.gnupg/taymyr.gpg

deploy:

Deploy releases

...

subprojects { nexusPublishing { repositories { sonatype() } clientTimeout.set(Duration.parse("PT10M")) // 10 minutes } } ... nexusStaging { packageGroup = "org.taymyr" username = ossrhUsername password = ossrhPassword numberOfRetries = 360 // 1 hour if 10 seconds delay delayBetweenRetriesInMillis = 10000 // 10 seconds }

tasks.closeRepository { mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) } tasks.closeAndReleaseRepository { mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray()) }

3. Settings of plugins in submodules ([/java/api/build.gradle.kts#L53-L69](https://github.com/taymyr/lagom-openapi/blob/0785237eb29bdd170d3df1c9e9d41ceaef24ee75/java/api/build.gradle.kts#L53-L69))
```kotlin
publishing {
    publications {
        create<MavenPublication>("maven") {
            artifactId = "${project.name}_$scalaBinaryVersion"
            from(components["java"])
            artifact(sourcesJar)
            artifact(dokkaJar)
            pom(Publishing.pom)
        }
    }
}

@Suppress("UnstableApiUsage")
signing {
    isRequired = isRelease
    sign(publishing.publications["maven"])
}
sleipnir commented 4 years ago

Hi @ihostage thanks for the suggestions, I was really aware of the manual step but I didn't have time to look for another approach. Would you like to send a PR with the necessary changes? If you don't want to, I'll take a look at your repository and try to reproduce it. Thanks