Skip to content

Commit 32904e2

Browse files
authored
Migrate to Sonatype Central Portal (#1563)
* Migrate to Sonatype Central Portal * Update developers in pom
1 parent 0e86859 commit 32904e2

File tree

13 files changed

+215
-263
lines changed

13 files changed

+215
-263
lines changed

.github/workflows/publish-new-version.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ jobs:
2828
bump: ${{ inputs.bump }}
2929
file-path: ./buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt
3030
excluded-modules: "demo-app,tutorials:tutorial-video,tutorials:tutorial-audio"
31+
use-official-plugin: false
32+
# Disable explicit documentation tasks as they are already included while publishing
33+
documentation-tasks: tasks
3134
secrets:
3235
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3336
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
3437
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
3538
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
3639
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
37-
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
3840
STREAM_PUBLIC_BOT_TOKEN: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}

.github/workflows/publish-snapshot.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,15 @@ jobs:
2121

2222
- uses: GetStream/android-ci-actions/actions/setup-java@main
2323

24-
- name: Release build
25-
# assembleRelease for all modules, excluding non-library modules: samples, docs
26-
run: ./gradlew assembleRelease -x :demo-app:assembleRelease
27-
28-
- name: Source jar and dokka
29-
run: ./gradlew androidSourcesJar javadocJar
30-
3124
- name: Publish to MavenCentral
32-
run: ./gradlew publishReleasePublicationToSonatypeRepository
25+
run: ./gradlew publishToMavenCentral --no-configuration-cache
3326
env:
34-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
35-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
36-
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
37-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
38-
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
39-
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
27+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
28+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
29+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
30+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
31+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
32+
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
4033
SNAPSHOT: true
4134
- name: Show snapshot version
4235
run: ./scripts/show-last-snapshot-update.sh

build.gradle.kts

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
apply(plugin = "io.github.gradle-nexus.publish-plugin")
2-
apply(plugin = "org.jetbrains.dokka")
1+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
2+
import io.getstream.video.android.Configuration
3+
34
apply(from = "${rootDir}/scripts/open-api-code-gen.gradle.kts")
45

56
buildscript {
@@ -29,7 +30,7 @@ plugins {
2930
alias(libs.plugins.kotlin.compatibility.validator) apply false
3031
alias(libs.plugins.ksp) apply false
3132
alias(libs.plugins.wire) apply false
32-
alias(libs.plugins.nexus) apply false
33+
alias(libs.plugins.maven.publish)
3334
alias(libs.plugins.google.gms) apply false
3435
alias(libs.plugins.dokka) apply false
3536
alias(libs.plugins.spotless) apply false
@@ -69,7 +70,85 @@ tasks.register("clean")
6970
delete(rootProject.buildDir)
7071
}
7172

72-
apply(from = "${rootDir}/scripts/publish-root.gradle")
73+
private val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() == true
74+
version = if (isSnapshot) Configuration.snapshotVersionName else Configuration.versionName
75+
76+
subprojects {
77+
plugins.withId("com.vanniktech.maven.publish") {
78+
extensions.configure<MavenPublishBaseExtension> {
79+
publishToMavenCentral(automaticRelease = true)
80+
81+
pom {
82+
name.set(project.name)
83+
description.set("Stream Video official Android SDK")
84+
url.set("https://github.com/getstream/stream-video-android")
85+
86+
licenses {
87+
license {
88+
name.set("Stream License")
89+
url.set("https://github.com/GetStream/stream-video-android/blob/main/LICENSE")
90+
}
91+
}
92+
93+
developers {
94+
developer {
95+
id = "aleksandar-apostolov"
96+
name = "Aleksandar Apostolov"
97+
98+
}
99+
developer {
100+
id = "VelikovPetar"
101+
name = "Petar Velikov"
102+
103+
}
104+
developer {
105+
id = "andremion"
106+
name = "André Mion"
107+
108+
}
109+
developer {
110+
id = "rahul-lohra"
111+
name = "Rahul Kumar Lohra"
112+
113+
}
114+
developer {
115+
id = "PratimMallick"
116+
name = "Pratim Mallick"
117+
118+
}
119+
developer {
120+
id = "gpunto"
121+
name = "Gianmarco David"
122+
123+
}
124+
}
125+
126+
scm {
127+
connection.set("scm:git:github.com/getstream/stream-video-android.git")
128+
developerConnection.set("scm:git:ssh://github.com/getstream/stream-video-android.git")
129+
url.set("https://github.com/getstream/stream-video-android/tree/main")
130+
}
131+
}
132+
}
133+
}
134+
}
135+
136+
tasks.register("printAllArtifacts") {
137+
group = "publishing"
138+
description = "Prints all artifacts that will be published"
139+
140+
doLast {
141+
subprojects.forEach { subproject ->
142+
subproject.plugins.withId("com.vanniktech.maven.publish") {
143+
subproject.extensions.findByType(PublishingExtension::class.java)
144+
?.publications
145+
?.filterIsInstance<MavenPublication>()
146+
?.forEach { println("${it.groupId}:${it.artifactId}:${it.version}") }
147+
}
148+
}
149+
}
150+
}
151+
73152
//apply(from = teamPropsFile("git-hooks.gradle.kts"))
74153
//
75154
//fun teamPropsFile(propsFile: String): File {

gradle/libs.versions.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ cameraCamera2 = "1.3.4"
1010
kover = "0.8.3"
1111
sonarqube = "6.0.1.5171"
1212
spotless = "6.21.0"
13-
nexusPlugin = "1.3.0"
1413
streamConventions = "0.2.0"
14+
mavenPublish = "0.34.0"
1515
kotlin = "1.9.25"
1616
ksp = "1.9.25-1.0.20"
1717
kotlinSerialization = "1.6.3"
1818
kotlinSerializationConverter = "1.0.0"
1919
kotlinxCoroutines = "1.9.0"
2020
cameraCore = "1.4.2"
21-
2221
kotlinDokka = "1.9.20"
2322

2423
androidxMaterial = "1.12.0"
@@ -250,8 +249,8 @@ sonarqube = { id = "org.sonarqube", version.ref = "sonarqube"}
250249
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
251250
stream-android-application = { id = "io.getstream.android.application", version.ref = "streamConventions" }
252251
stream-android-library = { id = "io.getstream.android.library", version.ref = "streamConventions" }
252+
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish"}
253253
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlinDokka" }
254-
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPlugin" }
255254
google-gms = { id = "com.google.gms.google-services", version.ref = "googleService" }
256255
wire = { id = "com.squareup.wire", version.ref = "wire" }
257256
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }

scripts/publish-module.gradle

Lines changed: 0 additions & 105 deletions
This file was deleted.

scripts/publish-root.gradle

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
import com.vanniktech.maven.publish.JavadocJar
2+
import com.vanniktech.maven.publish.KotlinJvm
13
import io.getstream.video.android.Configuration
24

35
plugins {
4-
kotlin("jvm")
5-
}
6-
7-
rootProject.extra.apply {
8-
set("PUBLISH_GROUP_ID", Configuration.artifactGroup)
9-
set("PUBLISH_ARTIFACT_ID", "stream-video-android-bom")
10-
set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName"))
6+
alias(libs.plugins.maven.publish)
7+
alias(libs.plugins.dokka)
8+
kotlin("jvm")
119
}
1210

1311
dependencies {
@@ -21,4 +19,16 @@ dependencies {
2119
}
2220
}
2321

24-
apply(from ="${rootDir}/scripts/publish-module.gradle")
22+
mavenPublishing {
23+
coordinates(
24+
groupId = Configuration.artifactGroup,
25+
artifactId = "stream-video-android-bom",
26+
version = rootProject.version.toString(),
27+
)
28+
configure(
29+
KotlinJvm(
30+
javadocJar = JavadocJar.Dokka("dokkaJavadoc"),
31+
sourcesJar = true,
32+
),
33+
)
34+
}

0 commit comments

Comments
 (0)