Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 036fd88

Browse files
committedJun 3, 2021
Update release.gradle for maven publication
1 parent e2f5d84 commit 036fd88

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
 

‎ReactAndroid/release.gradle

+31
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ def isReleaseBuild() {
2020
return VERSION_NAME.contains("SNAPSHOT") == false
2121
}
2222

23+
def getRepositoryUrl() {
24+
return project.findProperty("repositoryUrl") ?: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
25+
}
26+
27+
def getRepositoryUsername() {
28+
return project.findProperty("repositoryUsername") ?: ""
29+
}
30+
31+
def getRepositoryPassword() {
32+
return project.findProperty("repositoryPassword") ?: ""
33+
}
34+
2335
def configureReactNativePom(def pom) {
2436
pom.project {
2537
name(POM_NAME)
@@ -72,9 +84,28 @@ afterEvaluate { project ->
7284

7385
signing {
7486
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
87+
useGpgCmd()
7588
sign(configurations.archives)
7689
}
7790

91+
uploadArchives {
92+
configuration = configurations.archives
93+
repositories.mavenDeployer {
94+
beforeDeployment {
95+
MavenDeployment deployment -> signing.signPom(deployment)
96+
}
97+
98+
repository(url: getRepositoryUrl()) {
99+
authentication(
100+
userName: getRepositoryUsername(),
101+
password: getRepositoryPassword())
102+
103+
}
104+
105+
configureReactNativePom(pom)
106+
}
107+
}
108+
78109
task installArchives(type: Upload) {
79110
configuration = configurations.archives
80111
repositories.mavenDeployer {

0 commit comments

Comments
 (0)
Please sign in to comment.