Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 1.0.0-EAP to master #31

Merged
merged 18 commits into from
Feb 8, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[asyncapi-gradle-plugin]: 1.0.0-EAP with release configuration and re…
…lease instruction
Pakisan committed Jan 30, 2021
commit a1db327908bc150e11e50e73937742e8bc6be044
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@ This monorepo stores modules, which simplifies interacting with AsyncAPI in `jvm
* [plugin](#plugin)
* [Release](#release)
* [maven artifacts](#release-maven-artifacts)
* [gradle artifacts](#release-gradle-artifacts)
* [relese to maven central](#release-to-maven-central)
* [release to gradle plugins](#release-to-gradle-plugins)

## Monorepo structure
Currently here it's splitted on two submodules:
@@ -154,4 +157,56 @@ _Example_
* Build it, test it and release it to maven central repository
```shell script
➜ async-api git:(1.0.0-EAP) ✗ mvn clean deploy -P release
```

### Release gradle artifacts:

#### release to maven central
**[gradle gpg instruction](https://docs.gradle.org/current/userguide/signing_plugin.html#signing_plugin)**
<br>
**[sonatype's instruction for deployment releasing](https://central.sonatype.org/pages/releasing-the-deployment.html)**

* Request credentials for one of AsyncAPI's account on [Sonatype's Jira](https://issues.sonatype.org), which is synced
with [Sonatype's nexus](https://oss.sonatype.org)
* Generate pgp key if it was not generated yet
* export secret key ring file containing your private key
```shell script
gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
```
* Create `/Users/{userName}/.gradle/gradle.properties`
```properties
# gpg
signing.keyId={key name}
signing.password={key passphrase}
signing.secretKeyRingFile=/Users/{userName}/.gnupg/secring.gpg
# oss.sonatype.org
ossrhUsername={Jira username}
ossrhPassword={Jira password}
```
* Choose new release version and set it to root [build.gradle.kts](./asyncapi-plugin/asyncapi-plugin-gradle/build.gradle.kts).
_Example_
```kotlin
version = "{new release version}"
```
* Build it, test it and release it to maven central repository
```shell script
➜ asyncapi-plugin-gradle git:(1.0.0-EAP) ✗ ./gradlew publishPluginMavenPublicationToMavenRepository
```
* Go to [stagin repositories](https://oss.sonatype.org/#stagingRepositories) and release it manually
* Select repository
* Click `close` and wait some time
* Click `release`

#### release to gradle plugins

* Request `key` and `secret` for gradle account
* Update `/Users/{userName}/.gradle/gradle.properties` with gradle credential
```properties
gradle.publish.key={key}
gradle.publish.secret={secret}
```
* Release plugin to [gradle plugins](https://plugins.gradle.org/)
```shell script
➜ asyncapi-plugin-gradle git:(1.0.0-EAP) ✗ ./gradlew publishPlugins
```
100 changes: 92 additions & 8 deletions asyncapi-plugin/asyncapi-plugin-gradle/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
plugins {
id("java-gradle-plugin")
id("com.gradle.plugin-publish") version "0.10.1"
id("com.gradle.plugin-publish") version "0.12.0"
id("org.jetbrains.kotlin.jvm") version "1.3.61"
`maven-publish`
signing
}

repositories {
@@ -45,19 +47,101 @@ tasks {
}
}

pluginBundle {
website = "https://github.com/Pakisan/java-asyncapi"
vcsUrl = "https://github.com/Pakisan/java-asyncapi.git"
tags = listOf("async-api", "async api", "asyncapi", "java", "kotlin")
}
/*
Publishing configuration for: https://plugins.gradle.org
*/

gradlePlugin {
plugins {
create("asyncapiPlugin") {
id = "com.asyncapi.asyncapi-gradle-plugin"
id = "${project.group}.${rootProject.name}"
implementationClass = "com.asyncapi.plugin.gradle.AsyncAPIPlugin"
}
}
}

pluginBundle {
website = "https://github.com/asyncapi/jasyncapi"
vcsUrl = "https://github.com/asyncapi/jasyncapi.git"
description = "Gradle plugin for AsyncAPI.\nHelps to generate AsyncAPI specification from hand-crafted AsyncAPI class at choosed build cycle step."
tags = listOf("async-api", "async api", "asyncapi", "java", "kotlin")
(plugins) {
"asyncapiPlugin" {
id = "${project.group}.${rootProject.name}"
version = "${project.version}"
displayName = "AsyncAPI gradle plugin"
description = "Gradle plugin for AsyncAPI. Helps to generate asyncapi schemas from sources"
implementationClass = "com.asyncapi.plugin.gradle.AsyncAPIPlugin"
}
}
mavenCoordinates {
groupId = "${project.group}"
artifactId = "${rootProject.name}"
version = "${project.version}"
}
}

/*
Publishing configuration for: central maven repository
*/

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
create<MavenPublication>("pluginMaven") {
groupId = "${project.group}"
artifactId = "${rootProject.name}"
version = "${project.version}"

pom {
name.set("AsyncAPI Gradle plugin")
inceptionYear.set("2020")
url.set("https://github.com/asyncapi/jasyncapi")
description.set("Gradle plugin for AsyncAPI.\n" +
"Helps to generate AsyncAPI specification from hand-crafted AsyncAPI class at choosed build cycle step.")
organization {
name.set("AsyncAPI Initiative")
url.set("https://www.asyncapi.com/")
}
developers {
developer {
name.set("Pavel Bodiachevskii")
url.set("https://github.com/Pakisan")
}
}
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
comments.set("A business-friendly OSS license")
}
}
scm {
url.set("https://github.com/asyncapi/jasyncapi")
connection.set("scm:git:https://github.com/asyncapi/jasyncapi.git")
tag.set("HEAD")
}
packaging = "jar"
}
}
}
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = project.property("ossrhUsername") as String?
password = project.property("ossrhPassword") as String?
}
}
}
}

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