Skip to content

Commit c2f1307

Browse files
authored
Configure publishing through convention plugins and migrate to common workflow (#1593)
1 parent f094228 commit c2f1307

File tree

13 files changed

+62
-262
lines changed

13 files changed

+62
-262
lines changed

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ on:
44
workflow_dispatch:
55
inputs:
66
bump:
7+
required: true
78
type: choice
89
description: "Type of version bump to perform"
910
options:
1011
- patch
1112
- minor
1213
- major
14+
default: minor
15+
16+
concurrency:
17+
group: release
18+
cancel-in-progress: false
1319

1420
jobs:
1521
pre_release_check:
@@ -21,20 +27,16 @@ jobs:
2127
id: pre_release_check_step
2228
run: echo "Pre release check"
2329
publish:
30+
permissions:
31+
contents: write
2432
needs: pre_release_check
25-
uses: GetStream/android-ci-actions/.github/workflows/release-new-version.yml@main
33+
uses: GetStream/stream-build-conventions-android/.github/workflows/release.yml@v0.5.0
2634
with:
27-
ref: "develop"
2835
bump: ${{ inputs.bump }}
29-
file-path: ./buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt
30-
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
3436
secrets:
35-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
36-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
37-
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
38-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
39-
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
40-
STREAM_PUBLIC_BOT_TOKEN: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
37+
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
38+
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
39+
maven-central-password: ${{ secrets.OSSRH_PASSWORD }}
40+
signing-key: ${{ secrets.SIGNING_KEY }}
41+
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
42+
signing-key-password: ${{ secrets.SIGNING_PASSWORD }}

build.gradle.kts

Lines changed: 9 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
import com.vanniktech.maven.publish.MavenPublishBaseExtension
2-
import io.getstream.video.android.Configuration
3-
import java.text.SimpleDateFormat
4-
import java.util.Date
5-
import java.util.TimeZone
6-
71
apply(from = "${rootDir}/scripts/open-api-code-gen.gradle.kts")
82

93
buildscript {
@@ -27,14 +21,15 @@ plugins {
2721
alias(libs.plugins.stream.android.application) apply false
2822
alias(libs.plugins.stream.android.library) apply false
2923
alias(libs.plugins.stream.android.test) apply false
24+
alias(libs.plugins.stream.java.library) apply false
25+
alias(libs.plugins.stream.java.platform) apply false
3026
alias(libs.plugins.android.application) apply false
3127
alias(libs.plugins.kotlin.android) apply false
3228
// alias(libs.plugins.compose.compiler) apply false -> Enable with Kotlin 2.0+
3329
alias(libs.plugins.kotlin.serialization) apply false
3430
alias(libs.plugins.kotlin.compatibility.validator) apply false
3531
alias(libs.plugins.ksp) apply false
3632
alias(libs.plugins.wire) apply false
37-
alias(libs.plugins.maven.publish)
3833
alias(libs.plugins.google.gms) apply false
3934
alias(libs.plugins.dokka)
4035
alias(libs.plugins.spotless) apply false
@@ -66,6 +61,13 @@ streamProject {
6661
"io.getstream.video.android.core.model.*"
6762
)
6863
}
64+
65+
publishing {
66+
description = "Stream Video official Android SDK"
67+
moduleArtifactIdOverrides = mapOf(
68+
"stream-video-android-ui-xml" to "stream-video-android-xml"
69+
)
70+
}
6971
}
7072

7173
subprojects {
@@ -90,94 +92,6 @@ subprojects {
9092
}
9193
}
9294

93-
private val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() == true
94-
95-
version = if (isSnapshot) {
96-
val timestamp = SimpleDateFormat("yyyyMMddHHmm").run {
97-
timeZone = TimeZone.getTimeZone("UTC")
98-
format(Date())
99-
}
100-
"${Configuration.snapshotBasedVersionName}-${timestamp}-SNAPSHOT"
101-
} else {
102-
Configuration.versionName
103-
}
104-
105-
subprojects {
106-
plugins.withId("com.vanniktech.maven.publish") {
107-
extensions.configure<MavenPublishBaseExtension> {
108-
publishToMavenCentral(automaticRelease = true)
109-
110-
pom {
111-
name.set(project.name)
112-
description.set("Stream Video official Android SDK")
113-
url.set("https://github.com/getstream/stream-video-android")
114-
115-
licenses {
116-
license {
117-
name.set("Stream License")
118-
url.set("https://github.com/GetStream/stream-video-android/blob/main/LICENSE")
119-
}
120-
}
121-
122-
developers {
123-
developer {
124-
id = "aleksandar-apostolov"
125-
name = "Aleksandar Apostolov"
126-
127-
}
128-
developer {
129-
id = "VelikovPetar"
130-
name = "Petar Velikov"
131-
132-
}
133-
developer {
134-
id = "andremion"
135-
name = "André Mion"
136-
137-
}
138-
developer {
139-
id = "rahul-lohra"
140-
name = "Rahul Kumar Lohra"
141-
142-
}
143-
developer {
144-
id = "PratimMallick"
145-
name = "Pratim Mallick"
146-
147-
}
148-
developer {
149-
id = "gpunto"
150-
name = "Gianmarco David"
151-
152-
}
153-
}
154-
155-
scm {
156-
connection.set("scm:git:github.com/getstream/stream-video-android.git")
157-
developerConnection.set("scm:git:ssh://github.com/getstream/stream-video-android.git")
158-
url.set("https://github.com/getstream/stream-video-android/tree/main")
159-
}
160-
}
161-
}
162-
}
163-
}
164-
165-
tasks.register("printAllArtifacts") {
166-
group = "publishing"
167-
description = "Prints all artifacts that will be published"
168-
169-
doLast {
170-
subprojects.forEach { subproject ->
171-
subproject.plugins.withId("com.vanniktech.maven.publish") {
172-
subproject.extensions.findByType(PublishingExtension::class.java)
173-
?.publications
174-
?.filterIsInstance<MavenPublication>()
175-
?.forEach { println("${it.groupId}:${it.artifactId}:${it.version}") }
176-
}
177-
}
178-
}
179-
}
180-
18195
//apply(from = teamPropsFile("git-hooks.gradle.kts"))
18296
//
18397
//fun teamPropsFile(propsFile: String): File {
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
package io.getstream.video.android
22

33
object Configuration {
4-
const val majorVersion = 1
5-
const val minorVersion = 18
6-
const val patchVersion = 3
7-
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
8-
const val versionCode = 57
9-
const val snapshotBasedVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}"
10-
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
11-
const val artifactGroup = "io.getstream"
12-
const val streamVideoCallGooglePlayVersion = versionName
134
const val streamWebRtcVersionName = "1.3.6"
145
}

demo-app/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import com.android.build.api.variant.ResValue
2020
import com.github.triplet.gradle.androidpublisher.ResolutionStrategy
2121
import io.getstream.video.FlavorDimension
2222
import io.getstream.video.VideoDemoFlavor
23-
import io.getstream.video.android.Configuration
2423
import java.io.FileInputStream
2524
import java.util.Properties
2625

@@ -45,7 +44,7 @@ android {
4544
minSdk = libs.versions.minSdk.get().toInt()
4645
targetSdk = libs.versions.targetSdk.get().toInt()
4746
versionCode = 1
48-
versionName = Configuration.streamVideoCallGooglePlayVersion
47+
versionName = rootProject.version.toString()
4948
testInstrumentationRunner = "io.qameta.allure.android.runners.AllureAndroidJUnitRunner"
5049
testInstrumentationRunnerArguments["clearPackageData"] = "true"
5150
missingDimensionStrategy(FlavorDimension.contentType.name, VideoDemoFlavor.development.name)
@@ -197,7 +196,7 @@ androidComponents {
197196
applicationVariant.outputs.forEach {
198197
it.versionName.set(
199198
it.versionCode.map { playVersionCode ->
200-
"${Configuration.streamVideoCallGooglePlayVersion} ($playVersionCode)"
199+
"${rootProject.version} ($playVersionCode)"
201200
},
202201
)
203202
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ android.suppressUnsupportedCompileSdk=34
4343

4444
# Build Compose Compiler metrics
4545
enableComposeCompilerMetrics=true
46-
enableComposeCompilerReports=true
46+
enableComposeCompilerReports=true
47+
48+
# Project version
49+
version=1.18.3

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ allureKotlin = "2.4.0"
88
androidGradlePlugin = "8.5.2"
99
cameraCamera2 = "1.3.4"
1010
spotless = "6.21.0"
11-
streamConventions = "0.4.0"
12-
mavenPublish = "0.34.0"
11+
streamConventions = "0.5.0"
1312
kotlin = "1.9.25"
1413
ksp = "1.9.25-1.0.20"
1514
kotlinSerialization = "1.6.3"
@@ -247,7 +246,8 @@ stream-project = { id = "io.getstream.project", version.ref = "streamConventions
247246
stream-android-application = { id = "io.getstream.android.application", version.ref = "streamConventions" }
248247
stream-android-library = { id = "io.getstream.android.library", version.ref = "streamConventions" }
249248
stream-android-test = { id = "io.getstream.android.test", version.ref = "streamConventions" }
250-
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish"}
249+
stream-java-library = { id = "io.getstream.java.library", version.ref = "streamConventions" }
250+
stream-java-platform = { id = "io.getstream.java.platform", version.ref = "streamConventions" }
251251
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlinDokka" }
252252
google-gms = { id = "com.google.gms.google-services", version.ref = "googleService" }
253253
wire = { id = "com.squareup.wire", version.ref = "wire" }
Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
import com.vanniktech.maven.publish.JavadocJar
2-
import com.vanniktech.maven.publish.KotlinJvm
3-
import io.getstream.video.android.Configuration
4-
51
plugins {
6-
alias(libs.plugins.maven.publish)
72
alias(libs.plugins.dokka)
8-
kotlin("jvm")
3+
alias(libs.plugins.stream.java.platform)
94
}
105

11-
dependencies {
12-
constraints {
13-
api(project(":stream-video-android-core"))
14-
api(project(":stream-video-android-ui-core"))
15-
api(project(":stream-video-android-ui-xml"))
16-
api(project(":stream-video-android-ui-compose"))
17-
api(project(":stream-video-android-filters-video"))
18-
api(project(":stream-video-android-previewdata"))
19-
}
6+
spotless {
7+
// Point to non-existent file pattern because this module has no source files
8+
java {
9+
target("no-files-to-format")
10+
}
11+
kotlin {
12+
target("no-files-to-format")
13+
}
2014
}
2115

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-
)
16+
dependencies {
17+
constraints {
18+
api(project(":stream-video-android-core"))
19+
api(project(":stream-video-android-ui-core"))
20+
api(project(":stream-video-android-ui-xml"))
21+
api(project(":stream-video-android-ui-compose"))
22+
api(project(":stream-video-android-filters-video"))
23+
api(project(":stream-video-android-previewdata"))
24+
}
3425
}

stream-video-android-core/build.gradle.kts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
1716
import io.getstream.video.android.Configuration
1817
import java.io.FileInputStream
1918
import java.util.Properties
2019

2120
plugins {
22-
alias(libs.plugins.maven.publish)
2321
id("io.getstream.video.android.library")
2422
id("io.getstream.video.generateServices")
2523
id(libs.plugins.kotlin.serialization.get().pluginId)
@@ -62,10 +60,17 @@ android {
6260
minSdk = libs.versions.minSdk.get().toInt()
6361
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
6462
consumerProguardFiles("consumer-proguard-rules.pro")
65-
buildConfigField("String", "STREAM_VIDEO_VERSION", "\"${Configuration.versionName}\"")
66-
buildConfigField("Integer", "STREAM_VIDEO_VERSION_MAJOR", "${Configuration.majorVersion}")
67-
buildConfigField("Integer", "STREAM_VIDEO_VERSION_MINOR", "${Configuration.minorVersion}")
68-
buildConfigField("Integer", "STREAM_VIDEO_VERSION_PATCH", "${Configuration.patchVersion}")
63+
64+
val versionParts =
65+
version.toString()
66+
.takeWhile { it.isDigit() || it == '.' }
67+
.split(".")
68+
.mapNotNull(String::toIntOrNull)
69+
.also { require(it.size == 3) { "Unexpected version format: $version" } }
70+
buildConfigField("String", "STREAM_VIDEO_VERSION", "\"$version\"")
71+
buildConfigField("Integer", "STREAM_VIDEO_VERSION_MAJOR", "${versionParts[0]}")
72+
buildConfigField("Integer", "STREAM_VIDEO_VERSION_MINOR", "${versionParts[1]}")
73+
buildConfigField("Integer", "STREAM_VIDEO_VERSION_PATCH", "${versionParts[2]}")
6974
buildConfigField(
7075
"String",
7176
"STREAM_WEBRTC_VERSION",
@@ -226,21 +231,6 @@ dependencies {
226231
androidTestImplementation(libs.turbine)
227232
}
228233

229-
mavenPublishing {
230-
coordinates(
231-
groupId = Configuration.artifactGroup,
232-
artifactId = "stream-video-android-core",
233-
version = rootProject.version.toString(),
234-
)
235-
configure(
236-
AndroidSingleVariantLibrary(
237-
variant = "release",
238-
sourcesJar = true,
239-
publishJavadocJar = true,
240-
),
241-
)
242-
}
243-
244234
afterEvaluate {
245235
tasks.named("testDebugUnitTest") {
246236
dependsOn("isolatedTest")

stream-video-android-filters-video/build.gradle.kts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
17-
import io.getstream.video.android.Configuration
1816

1917
plugins {
20-
alias(libs.plugins.maven.publish)
2118
id("io.getstream.video.android.library")
2219
}
2320

@@ -44,18 +41,3 @@ dependencies {
4441
// renderscript-toolkit
4542
implementation(libs.stream.renderscript)
4643
}
47-
48-
mavenPublishing {
49-
coordinates(
50-
groupId = Configuration.artifactGroup,
51-
artifactId = "stream-video-android-filters-video",
52-
version = rootProject.version.toString(),
53-
)
54-
configure(
55-
AndroidSingleVariantLibrary(
56-
variant = "release",
57-
sourcesJar = true,
58-
publishJavadocJar = true,
59-
),
60-
)
61-
}

0 commit comments

Comments
 (0)