Skip to content

Commit 95ef031

Browse files
mdjastrzebskikrozniata
authored andcommitted
chore: publish to maven central
1 parent 7e75bae commit 95ef031

4 files changed

Lines changed: 86 additions & 3 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd ./gradle-plugins/react
6+
7+
./gradlew build
8+
./gradlew :brownfield:publishToMavenLocal
9+
./gradlew signing
10+

gradle-plugins/publish-to-maven-local.sh

100644100755
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
cd ./gradle-plugins/react && ./gradlew build || exit 1
2-
./gradlew :brownfield:publishToMavenLocal
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd ./react
6+
7+
./gradlew build
8+
./gradlew :brownfield:publishToMavenLocal

gradle-plugins/react/brownfield/build.gradle.kts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import java.util.Properties
2+
13
plugins {
24
alias(libs.plugins.kotlinJvm)
35
`java-gradle-plugin`
46
alias(libs.plugins.ktlint)
57
alias(libs.plugins.detekt)
68
`maven-publish`
9+
signing
710
}
811

912
ktlint {
@@ -42,6 +45,67 @@ publishing {
4245
publications.withType<MavenPublication>().configureEach {
4346
artifactId = property("ARTIFACT_ID").toString()
4447
}
48+
49+
publications {
50+
create<MavenPublication>("mavenCentral") {
51+
from(components["java"])
52+
53+
groupId = property("GROUP").toString()
54+
artifactId = property("ARTIFACT_ID").toString()
55+
version = property("VERSION").toString()
56+
57+
pom {
58+
name.set(property("DISPLAY_NAME").toString())
59+
description.set(property("DESCRIPTION").toString())
60+
url.set(property("GITHUB_URL").toString())
61+
62+
licenses {
63+
license {
64+
name.set("The MIT License")
65+
url.set("https://opensource.org/licenses/MIT")
66+
distribution.set("repo")
67+
}
68+
}
69+
developers {
70+
developer {
71+
id.set("callstack")
72+
name.set("Callstack Team")
73+
email.set("it-admin@callstack.com")
74+
}
75+
}
76+
scm {
77+
connection.set(property("SCM_CONNECTION").toString())
78+
developerConnection.set(property("SCM_DEV_CONNECTION").toString())
79+
url.set(property("GITHUB_URL").toString())
80+
}
81+
}
82+
}
83+
}
84+
85+
repositories {
86+
maven {
87+
name = "MavenCentral"
88+
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") // Maven Central URL
89+
90+
credentials {
91+
username = findProperty("mavenCentralUsername") as String? ?: ""
92+
password = findProperty("mavenCentralToken") as String? ?: ""
93+
}
94+
}
95+
}
96+
}
97+
98+
99+
val localProperties = Properties().apply {
100+
file("local.properties").takeIf { it.exists() }?.inputStream()?.use { load(it) }
101+
}
102+
103+
signing {
104+
useInMemoryPgpKeys(
105+
localProperties.getProperty("signingKey"), // GPG private key
106+
localProperties.getProperty("signingPassword") // Passphrase
107+
)
108+
sign(publishing.publications["mavenCentral"]) // Sign the Maven publication
45109
}
46110

47111
repositories {

gradle-plugins/react/brownfield/gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ GROUP=com.callstack.react
55
IMPLEMENTATION_CLASS=com.callstack.react.brownfield.plugin.RNBrownfieldPlugin
66

77
DISPLAY_NAME=React Native Brownfield Gradle Plugin
8-
DESCRIPTION=Helps you generate Fat Aar for React Native Brownfield Projects
8+
DESCRIPTION=Helps you generate Fat Aar for React Native Brownfield Projects
9+
GITHUB_URL=https://github.com/callstack/react-native-brownfield/
10+
SCM_CONNECTION=scm:git:git://github.com/callstack/react-native-brownfield.git
11+
SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:callstack/react-native-brownfield.git

0 commit comments

Comments
 (0)