diff --git a/gradle-plugins/publish-to-maven-local.sh b/gradle-plugins/publish-to-maven-local.sh old mode 100644 new mode 100755 index e9864258..39db8b77 --- a/gradle-plugins/publish-to-maven-local.sh +++ b/gradle-plugins/publish-to-maven-local.sh @@ -1,2 +1,8 @@ -cd ./gradle-plugins/react && ./gradlew build || exit 1 -./gradlew :brownfield:publishToMavenLocal \ No newline at end of file +#!/bin/bash + +set -e + +cd ./gradle-plugins/react +./gradlew clean +./gradlew build +./gradlew :brownfield:publishMavenLocalPublicationToMavenLocalRepository \ No newline at end of file diff --git a/gradle-plugins/react/PUBLISHING.md b/gradle-plugins/react/PUBLISHING.md new file mode 100644 index 00000000..048eb7a8 --- /dev/null +++ b/gradle-plugins/react/PUBLISHING.md @@ -0,0 +1,30 @@ +# Publishing a Signed Plugin + +To publish a signed plugin (currently to `mavenLocal` only), you need to configure the signing key data in plugin's `gradle.properties` file + +> [!IMPORTANT] +> Make sure to clear `~/.m2` directory before starting publishing process + +### 1. Add Signing Key Data +Update `gradle.properties` file with the following properties: +``` +signing.keyId= +signing.password= +signing.secretKeyRingFile= +``` +* `keyId`: The public key ID. +* `password`: The passphrase used when creating the key. +* `secretKeyRingFile`: The absolute path to the private key file. + +### 2. Publish the Plugin +Once the signing key is set up correctly, run the following command: +```sh +yarn brownfield:plugin:publish:local +``` + +### 3. Output +If everything is configured properly, the signed plugin will be published to the `~/.m2` repository. + +### 4. Publishing +Go to `~/.m2/repository`, ZIP created plugin at `com` directory level (make sure there isn't any other plugin inside it) and upload it to [Maven Central](https://central.sonatype.com/) + diff --git a/gradle-plugins/react/brownfield/build.gradle.kts b/gradle-plugins/react/brownfield/build.gradle.kts index 2b51e2c9..5a19793c 100644 --- a/gradle-plugins/react/brownfield/build.gradle.kts +++ b/gradle-plugins/react/brownfield/build.gradle.kts @@ -1,9 +1,12 @@ +import java.util.Properties + plugins { alias(libs.plugins.kotlinJvm) `java-gradle-plugin` alias(libs.plugins.ktlint) alias(libs.plugins.detekt) `maven-publish` + signing } ktlint { @@ -42,6 +45,50 @@ publishing { publications.withType().configureEach { artifactId = property("ARTIFACT_ID").toString() } + + publications { + create("mavenLocal") { + from(components["java"]) + + groupId = property("GROUP").toString() + artifactId = property("ARTIFACT_ID").toString() + version = property("VERSION").toString() + + pom { + name.set(property("DISPLAY_NAME").toString()) + description.set(property("DESCRIPTION").toString()) + url.set(property("GITHUB_URL").toString()) + + licenses { + license { + name.set("The MIT License") + url.set("https://opensource.org/licenses/MIT") + distribution.set("repo") + } + } + developers { + developer { + id.set("callstack") + name.set("Callstack Team") + email.set("it-admin@callstack.com") + } + } + scm { + connection.set(property("SCM_CONNECTION").toString()) + developerConnection.set(property("SCM_DEV_CONNECTION").toString()) + url.set(property("GITHUB_URL").toString()) + } + } + } + } + + repositories { + mavenLocal() + } +} + +signing { + sign(publishing.publications["mavenLocal"]) } repositories { @@ -62,3 +109,19 @@ tasks.named("detekt").configure { tasks.register("lint") { dependsOn(":ktlintFormat") } + +java { + withJavadocJar() + withSourcesJar() +} + +tasks.javadoc { + if (JavaVersion.current().isJava9Compatible) { + (options as StandardJavadocDocletOptions).addBooleanOption("html5", true) + } + options { + encoding = "UTF-8" + source = "8" + } +} + diff --git a/gradle-plugins/react/brownfield/gradle.properties b/gradle-plugins/react/brownfield/gradle.properties index 63b6369e..3ccb2c9f 100644 --- a/gradle-plugins/react/brownfield/gradle.properties +++ b/gradle-plugins/react/brownfield/gradle.properties @@ -5,4 +5,7 @@ GROUP=com.callstack.react IMPLEMENTATION_CLASS=com.callstack.react.brownfield.plugin.RNBrownfieldPlugin DISPLAY_NAME=React Native Brownfield Gradle Plugin -DESCRIPTION=Helps you generate Fat Aar for React Native Brownfield Projects \ No newline at end of file +DESCRIPTION=Helps you generate Fat Aar for React Native Brownfield Projects +GITHUB_URL=https://github.com/callstack/react-native-brownfield/ +SCM_CONNECTION=scm:git:git://github.com/callstack/react-native-brownfield.git +SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:callstack/react-native-brownfield.git