Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 8 additions & 2 deletions gradle-plugins/publish-to-maven-local.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
cd ./gradle-plugins/react && ./gradlew build || exit 1
./gradlew :brownfield:publishToMavenLocal
#!/bin/bash

set -e

cd ./gradle-plugins/react
./gradlew clean
./gradlew build
./gradlew :brownfield:publishMavenLocalPublicationToMavenLocalRepository
30 changes: 30 additions & 0 deletions gradle-plugins/react/PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -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=<key>
signing.password=<password>
signing.secretKeyRingFile=<path-to-gpg-file>
```
* `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/)

63 changes: 63 additions & 0 deletions gradle-plugins/react/brownfield/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -42,6 +45,50 @@ publishing {
publications.withType<MavenPublication>().configureEach {
artifactId = property("ARTIFACT_ID").toString()
}

publications {
create<MavenPublication>("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 {
Expand All @@ -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"
}
}

5 changes: 4 additions & 1 deletion gradle-plugins/react/brownfield/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
Loading