Skip to content

Commit db8e7e0

Browse files
authored
Configure publishing through convention plugins and migrate to new workflow (#40)
1 parent ea3d6e7 commit db8e7e0

File tree

9 files changed

+27
-187
lines changed

9 files changed

+27
-187
lines changed

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

Lines changed: 16 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,17 @@ 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/blob/develop/.github/workflows/[email protected]
34+
2635
with:
27-
ref: "develop"
2836
bump: ${{ inputs.bump }}
29-
file-path: ./buildSrc/src/main/kotlin/io/getstream/core/Configuration.kt
30-
excluded-modules: "app"
31-
use-official-plugin: false
32-
# Disable explicit documentation tasks as they are already included while publishing
33-
documentation-tasks: tasks
3437
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 }}
38+
github-token: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}
39+
maven-central-username: ${{ secrets.OSSRH_USERNAME }}
40+
maven-central-password: ${{ secrets.OSSRH_PASSWORD }}
41+
signing-key: ${{ secrets.SIGNING_KEY }}
42+
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
43+
signing-key-password: ${{ secrets.SIGNING_PASSWORD }}

build.gradle.kts

Lines changed: 4 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import com.android.build.api.dsl.ApplicationExtension
22
import com.android.build.api.dsl.LibraryExtension
33
import com.vanniktech.maven.publish.MavenPublishBaseExtension
4-
import io.getstream.core.Configuration
54

65
plugins {
76
alias(libs.plugins.stream.project)
@@ -14,8 +13,6 @@ plugins {
1413
alias(libs.plugins.android.library) apply false
1514
alias(libs.plugins.kotlin.compose) apply false
1615
alias(libs.plugins.ksp) apply false
17-
alias(libs.plugins.maven.publish)
18-
alias(libs.plugins.dokka) apply false
1916
alias(libs.plugins.arturbosch.detekt) apply true
2017
}
2118

@@ -29,6 +26,10 @@ streamProject {
2926
coverage {
3027
includedModules = setOf("stream-android-core")
3128
}
29+
30+
publishing {
31+
description = "Stream Core official Android SDK"
32+
}
3233
}
3334

3435
detekt {
@@ -38,9 +39,6 @@ detekt {
3839
buildUponDefaultConfig = true
3940
}
4041

41-
private val isSnapshot = System.getenv("SNAPSHOT")?.toBoolean() == true
42-
version = if (isSnapshot) Configuration.snapshotVersionName else Configuration.versionName
43-
4442
subprojects {
4543
// Configure Android projects with common SDK versions as soon as either plugin is applied
4644
pluginManager.withPlugin("com.android.library") {
@@ -63,74 +61,3 @@ subprojects {
6361
}
6462
}
6563
}
66-
67-
subprojects {
68-
plugins.withId("com.vanniktech.maven.publish") {
69-
extensions.configure<MavenPublishBaseExtension> {
70-
publishToMavenCentral(automaticRelease = true)
71-
72-
pom {
73-
name.set("Stream Android Core")
74-
description.set("Stream Core official Android SDK")
75-
url.set("https://github.com/getstream/stream-core-android")
76-
77-
licenses {
78-
license {
79-
name.set("Stream License")
80-
url.set("https://github.com/GetStream/stream-core-android/blob/main/LICENSE")
81-
}
82-
}
83-
84-
developers {
85-
developer {
86-
id = "aleksandar-apostolov"
87-
name = "Aleksandar Apostolov"
88-
89-
}
90-
developer {
91-
id = "VelikovPetar"
92-
name = "Petar Velikov"
93-
94-
}
95-
developer {
96-
id = "andremion"
97-
name = "André Mion"
98-
99-
}
100-
developer {
101-
id = "rahul-lohra"
102-
name = "Rahul Kumar Lohra"
103-
104-
}
105-
developer {
106-
id = "gpunto"
107-
name = "Gianmarco David"
108-
109-
}
110-
}
111-
112-
scm {
113-
connection.set("scm:git:github.com/getstream/stream-core-android.git")
114-
developerConnection.set("scm:git:ssh://github.com/getstream/stream-core-android.git")
115-
url.set("https://github.com/getstream/stream-core-android/tree/main")
116-
}
117-
}
118-
}
119-
}
120-
}
121-
122-
tasks.register("printAllArtifacts") {
123-
group = "publishing"
124-
description = "Prints all artifacts that will be published"
125-
126-
doLast {
127-
subprojects.forEach { subproject ->
128-
subproject.plugins.withId("com.vanniktech.maven.publish") {
129-
subproject.extensions.findByType(PublishingExtension::class.java)
130-
?.publications
131-
?.filterIsInstance<MavenPublication>()
132-
?.forEach { println("${it.groupId}:${it.artifactId}:${it.version}") }
133-
}
134-
}
135-
}
136-
}

buildSrc/build.gradle.kts

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

buildSrc/src/main/kotlin/io/getstream/core/Configuration.kt

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

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
25+
# Project version
26+
version=1.1.1

gradle/libs.versions.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ retrofit = "3.0.0"
2626
ksp = "2.2.0-2.0.2"
2727
robolectric = "4.15.1"
2828
detekt = "1.23.8"
29-
streamConventions = "0.4.0"
30-
mavenPublish = "0.34.0"
31-
kotlinDokka = "1.9.20"
29+
streamConventions = "0.5.0"
3230
annotationJvm = "1.9.1"
3331

3432
[libraries]
@@ -83,5 +81,3 @@ stream-project = { id = "io.getstream.project", version.ref = "streamConventions
8381
stream-android-library = { id = "io.getstream.android.library", version.ref = "streamConventions" }
8482
stream-android-application = { id = "io.getstream.android.application", version.ref = "streamConventions" }
8583
stream-java-library = { id = "io.getstream.java.library", version.ref = "streamConventions" }
86-
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
87-
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlinDokka" }
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
1-
import com.vanniktech.maven.publish.JavadocJar
2-
import com.vanniktech.maven.publish.KotlinJvm
3-
import io.getstream.core.Configuration
4-
51
plugins {
6-
alias(libs.plugins.stream.java.library)
72
alias(libs.plugins.jetbrains.kotlin.jvm)
8-
alias(libs.plugins.maven.publish)
9-
alias(libs.plugins.dokka)
10-
}
11-
12-
mavenPublishing {
13-
coordinates(
14-
groupId = Configuration.artifactGroup,
15-
artifactId = "stream-android-core-annotations",
16-
version = rootProject.version.toString(),
17-
)
18-
configure(
19-
KotlinJvm(
20-
javadocJar = JavadocJar.Dokka("dokkaJavadoc"),
21-
sourcesJar = true,
22-
),
23-
)
3+
alias(libs.plugins.stream.java.library)
244
}
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import com.vanniktech.maven.publish.JavadocJar
2-
import com.vanniktech.maven.publish.KotlinJvm
3-
41
plugins {
5-
alias(libs.plugins.stream.java.library)
62
alias(libs.plugins.jetbrains.kotlin.jvm)
7-
alias(libs.plugins.maven.publish)
8-
alias(libs.plugins.dokka)
3+
alias(libs.plugins.stream.java.library)
94
}
105

116
dependencies {
@@ -22,17 +17,3 @@ tasks.jar {
2217
attributes["Lint-Registry-v2"] = "io.getstream.android.core.lint.StreamIssueRegistry"
2318
}
2419
}
25-
26-
mavenPublishing {
27-
coordinates(
28-
groupId = io.getstream.core.Configuration.artifactGroup,
29-
artifactId = "stream-android-core-lint",
30-
version = rootProject.version.toString(),
31-
)
32-
configure(
33-
KotlinJvm(
34-
javadocJar = JavadocJar.Dokka("dokkaJavadoc"),
35-
sourcesJar = true,
36-
),
37-
)
38-
}

stream-android-core/build.gradle.kts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
@file:OptIn(ExperimentalAbiValidation::class)
22

3-
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
4-
import io.getstream.core.Configuration
53
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
64
import org.jetbrains.kotlin.gradle.dsl.abi.ExperimentalAbiValidation
75

@@ -10,7 +8,6 @@ plugins {
108
alias(libs.plugins.kotlin.android)
119
alias(libs.plugins.ksp)
1210
alias(libs.plugins.arturbosch.detekt)
13-
alias(libs.plugins.maven.publish)
1411
}
1512

1613
kotlin {
@@ -86,18 +83,3 @@ dependencies {
8683
testImplementation(libs.kotlinx.coroutines.test)
8784
testImplementation(libs.mockwebserver)
8885
}
89-
90-
mavenPublishing {
91-
coordinates(
92-
groupId = Configuration.artifactGroup,
93-
artifactId = "stream-android-core",
94-
version = rootProject.version.toString(),
95-
)
96-
configure(
97-
AndroidSingleVariantLibrary(
98-
variant = "release",
99-
sourcesJar = true,
100-
publishJavadocJar = true,
101-
),
102-
)
103-
}

0 commit comments

Comments
 (0)