Skip to content

Commit f17e2f7

Browse files
authored
chore: updated the maven-publishing script to use nexus publishing (#853)
1 parent d9bd17a commit f17e2f7

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.github/actions/maven-publish/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ runs:
3030

3131
- name: Publish Android/Java Packages to Maven
3232
shell: bash
33-
run: ./gradlew publish -PisSnapshot=false --stacktrace
33+
run: ./gradlew publishToSonatype -PisSnapshot=false --stacktrace
3434
env:
3535
MAVEN_USERNAME: ${{ inputs.ossr-username }}
3636
MAVEN_PASSWORD: ${{ inputs.ossr-token }}

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ buildscript {
2121

2222
plugins {
2323
id 'org.jetbrains.dokka' version '1.9.20'
24+
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
2425
}
2526

2627
subprojects {

gradle/maven-publish.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ task sourcesJar(type: Jar) {
1414
from android.sourceSets.main.java.source
1515
}
1616

17-
final releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
18-
final snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
1917

2018
publishing {
2119
publications {
@@ -69,13 +67,14 @@ publishing {
6967
}
7068
}
7169
}
72-
repositories {
73-
maven {
74-
name = "sonatype"
75-
url = version.endsWith('SNAPSHOT') ? snapshotRepositoryUrl : releaseRepositoryUrl
76-
credentials {
77-
username = System.getenv("MAVEN_USERNAME")
78-
password = System.getenv("MAVEN_PASSWORD")
70+
71+
nexusPublishing {
72+
repositories {
73+
sonatype{
74+
nexusUrl.set(uri('https://ossrh-staging-api.central.sonatype.com/service/local/'))
75+
snapshotRepositoryUrl.set(uri('https://central.sonatype.com/repository/maven-snapshots/'))
76+
username.set(System.getenv("MAVEN_USERNAME"))
77+
password.set(System.getenv("MAVEN_PASSWORD"))
7978
}
8079
}
8180
}

0 commit comments

Comments
 (0)