Skip to content

Commit 003722a

Browse files
Release process (#7)
2 parents 01b38cb + fd4935f commit 003722a

File tree

11 files changed

+304
-13
lines changed

11 files changed

+304
-13
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish New Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
type: choice
8+
description: "Type of version bump to perform"
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
pre_release_check:
16+
name: Pre release check
17+
runs-on: ubuntu-24.04
18+
environment: 'publish'
19+
steps:
20+
- name: Check
21+
id: pre_release_check_step
22+
run: echo "Pre release check"
23+
publish:
24+
needs: pre_release_check
25+
uses: GetStream/android-ci-actions/.github/workflows/release-new-version.yml@main
26+
with:
27+
ref: "develop"
28+
bump: ${{ inputs.bump }}
29+
file-path: ./buildSrc/src/main/kotlin/io/getstream/core/Configuration.kt
30+
excluded-modules: "app"
31+
secrets:
32+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
33+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
34+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
35+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
36+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
37+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
38+
STREAM_PUBLIC_BOT_TOKEN: ${{ secrets.STREAM_PUBLIC_BOT_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
/.idea/assetWizardSettings.xml
1010
.DS_Store
1111
/build
12+
buildSrc/build
1213
/captures
1314
.externalNativeBuild
1415
.cxx
1516
local.properties
17+
.kotlin
1618

1719
# Log/OS Files
1820
*.log

build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import java.io.FileNotFoundException
22
import java.util.Calendar
3+
4+
apply(plugin = "io.github.gradle-nexus.publish-plugin")
5+
apply(plugin = "org.jetbrains.dokka")
6+
37
apply(from = "${rootDir}/gradle/scripts/sonar.gradle")
48
// Top-level build file where you can add configuration options common to all sub-projects/modules.
59
plugins {
@@ -9,6 +13,8 @@ plugins {
913
alias(libs.plugins.android.library) apply false
1014
alias(libs.plugins.kotlin.compose) apply false
1115
alias(libs.plugins.ksp) apply false
16+
alias(libs.plugins.dokka) apply false
17+
alias(libs.plugins.nexus) apply false
1218
alias(libs.plugins.arturbosch.detekt) apply true
1319
alias(libs.plugins.spotless) apply true
1420
alias(libs.plugins.sonarqube) apply true
@@ -68,4 +74,6 @@ subprojects {
6874
}
6975
}
7076
}
71-
}
77+
}
78+
79+
apply(from = "${rootDir}/scripts/publish-root.gradle")

buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
3+
*
4+
* Licensed under the Stream License;
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.getstream.core
17+
18+
object Configuration {
19+
const val compileSdk = 36
20+
const val targetSdk = 36
21+
const val sampleTargetSdk = 36
22+
const val minSdk = 21
23+
const val majorVersion = 0
24+
const val minorVersion = 0
25+
const val patchVersion = 1
26+
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
27+
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
28+
const val artifactGroup = "io.getstream"
29+
}

gradle/libs.versions.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ junit = "4.13.2"
77
junitVersion = "1.3.0"
88
espressoCore = "3.7.0"
99
appcompat = "1.7.1"
10-
kotlinxCoroutinesTest = "1.10.2"
10+
kotlinxCoroutines = "1.10.2"
1111
lintApi = "31.12.0"
1212
material = "1.12.0"
1313
jetbrainsKotlinJvm = "2.2.0"
@@ -25,7 +25,8 @@ detekt = "1.23.8"
2525
spotless = "7.2.1"
2626
kover = "0.9.1"
2727
sonarqube = "6.0.1.5171"
28-
28+
kotlinDokka = "1.9.20"
29+
nexusPlugin = "1.3.0"
2930

3031
[libraries]
3132
androidx-core = { module = "androidx.test:core", version.ref = "core" }
@@ -35,7 +36,8 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
3536
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
3637
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
3738
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
38-
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesTest" }
39+
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
40+
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
3941
lint-api = { module = "com.android.tools.lint:lint-api", version.ref = "lintApi" }
4042
lint-checks = { module = "com.android.tools.lint:lint-checks", version.ref = "lintApi" }
4143
lint-tests = { module = "com.android.tools.lint:lint-tests", version.ref = "lintApi" }
@@ -63,7 +65,6 @@ retrofit-moshi = { group = "com.squareup.retrofit2", name = "converter-moshi", v
6365
retrofit-scalars = { group = "com.squareup.retrofit2", name = "converter-scalars", version.ref = "retrofit" }
6466
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
6567

66-
6768
[plugins]
6869
android-application = { id = "com.android.application", version.ref = "agp" }
6970
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
@@ -73,6 +74,8 @@ kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "ko
7374
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
7475
arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
7576
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
77+
dokka = { id = "org.jetbrains.dokka", version.ref = "kotlinDokka" }
78+
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPlugin" }
7679
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover"}
7780
sonarqube = { id = "org.sonarqube", version.ref = "sonarqube"}
7881

scripts/publish-module.gradle

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
apply plugin: 'org.jetbrains.dokka'
4+
5+
tasks.register('androidSourcesJar', Jar) {
6+
archiveClassifier.set('sources')
7+
if (project.plugins.findPlugin("com.android.library")) {
8+
from android.sourceSets.main.java.srcDirs
9+
from android.sourceSets.main.kotlin.srcDirs
10+
} else {
11+
from sourceSets.main.java.srcDirs
12+
from sourceSets.main.kotlin.srcDirs
13+
}
14+
}
15+
16+
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
17+
pluginsMapConfiguration.set(
18+
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
19+
)
20+
}
21+
22+
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
23+
archiveClassifier.set('javadoc')
24+
from dokkaJavadoc.outputDirectory
25+
}
26+
27+
artifacts {
28+
archives androidSourcesJar
29+
archives javadocJar
30+
}
31+
32+
group = PUBLISH_GROUP_ID
33+
version = PUBLISH_VERSION
34+
35+
afterEvaluate {
36+
publishing {
37+
publications {
38+
release(MavenPublication) {
39+
tasks.named("generateMetadataFileForReleasePublication").configure { dependsOn("androidSourcesJar") }
40+
groupId PUBLISH_GROUP_ID
41+
artifactId PUBLISH_ARTIFACT_ID
42+
version PUBLISH_VERSION
43+
if (project.plugins.findPlugin("com.android.library")) {
44+
from components.release
45+
} else {
46+
from components.java
47+
}
48+
49+
artifact javadocJar
50+
51+
pom {
52+
name = PUBLISH_ARTIFACT_ID
53+
description = 'Stream Core official Android SDK'
54+
url = 'https://github.com/getstream/stream-android-core'
55+
licenses {
56+
license {
57+
name = 'Stream License'
58+
url = 'https://github.com/GetStream/stream-android-core/blob/main/LICENSE'
59+
}
60+
}
61+
developers {
62+
developer {
63+
id = 'jcminarro'
64+
name = 'Jc Miñarro'
65+
66+
}
67+
developer {
68+
id = 'aleksandar-apostolov'
69+
name = 'Aleksandar Apostolov'
70+
71+
}
72+
developer {
73+
id = 'VelikovPetar'
74+
name = 'Petar Velikov'
75+
76+
}
77+
developer {
78+
id = 'andremion'
79+
name = 'André Mion'
80+
81+
}
82+
developer {
83+
id = 'rahul-lohra'
84+
name = 'Rahul Kumar Lohra'
85+
86+
}
87+
developer {
88+
id = 'gpunto'
89+
name = 'Gianmarco'
90+
91+
}
92+
}
93+
scm {
94+
connection = 'scm:git:github.com/getstream/stream-android-core.git'
95+
developerConnection = 'scm:git:ssh://github.com/getstream/stream-android-core.git'
96+
url = 'https://github.com/getstream/stream-android-core/tree/main'
97+
}
98+
}
99+
}
100+
}
101+
}
102+
}
103+
104+
signing {
105+
useInMemoryPgpKeys(
106+
rootProject.ext["signing.keyId"],
107+
rootProject.ext["signing.key"],
108+
rootProject.ext["signing.password"],
109+
)
110+
sign publishing.publications
111+
}

scripts/publish-root.gradle

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import io.getstream.core.Configuration
2+
3+
// Create variables with empty default values
4+
ext["ossrhUsername"] = ''
5+
ext["ossrhPassword"] = ''
6+
ext["sonatypeStagingProfileId"] = ''
7+
ext["signing.keyId"] = ''
8+
ext["signing.password"] = ''
9+
ext["signing.key"] = ''
10+
ext["snapshot"] = ''
11+
12+
File secretPropsFile = project.rootProject.file('local.properties')
13+
if (secretPropsFile.exists()) {
14+
// Read local.properties file first if it exists
15+
Properties p = new Properties()
16+
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
17+
p.each { name, value -> ext[name] = value }
18+
} else {
19+
// Use system environment variables
20+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
21+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
22+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
23+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
24+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
25+
ext["signing.key"] = System.getenv('SIGNING_KEY')
26+
ext["snapshot"] = System.getenv('SNAPSHOT')
27+
}
28+
29+
if (snapshot) {
30+
ext["rootVersionName"] = Configuration.snapshotVersionName
31+
} else {
32+
ext["rootVersionName"] = Configuration.versionName
33+
}
34+
35+
// Set up Sonatype repository
36+
nexusPublishing {
37+
repositories {
38+
sonatype {
39+
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
40+
snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
41+
stagingProfileId = sonatypeStagingProfileId
42+
username = ossrhUsername
43+
password = ossrhPassword
44+
version = rootVersionName
45+
}
46+
}
47+
}
48+
49+
tasks.register("printAllArtifacts") {
50+
group = "publishing"
51+
52+
doLast {
53+
subprojects.each { subproject ->
54+
subproject.plugins.withId("maven-publish") {
55+
def publishingExtension = subproject.extensions.findByType(PublishingExtension)
56+
publishingExtension?.publications?.all { publication ->
57+
if (publication instanceof MavenPublication) {
58+
def groupId = publication.groupId
59+
def artifactId = publication.artifactId
60+
def version = publication.version
61+
println("$groupId:$artifactId:$version")
62+
}
63+
}
64+
}
65+
}
66+
}
67+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ plugins {
22
id("java-library")
33
alias(libs.plugins.jetbrains.kotlin.jvm)
44
}
5+
6+
rootProject.extra.apply {
7+
set("PUBLISH_GROUP_ID", io.getstream.core.Configuration.artifactGroup)
8+
set("PUBLISH_ARTIFACT_ID", "stream-android-core-annotations")
9+
set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName"))
10+
}
11+
12+
apply(from = "${rootDir}/scripts/publish-module.gradle")
13+
514
java {
615
sourceCompatibility = JavaVersion.VERSION_11
716
targetCompatibility = JavaVersion.VERSION_11

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ plugins {
22
id("java-library")
33
alias(libs.plugins.jetbrains.kotlin.jvm)
44
}
5+
6+
rootProject.extra.apply {
7+
set("PUBLISH_GROUP_ID", io.getstream.core.Configuration.artifactGroup)
8+
set("PUBLISH_ARTIFACT_ID", "stream-android-core-lint")
9+
set("PUBLISH_VERSION", rootProject.extra.get("rootVersionName"))
10+
}
11+
12+
apply(from = "${rootDir}/scripts/publish-module.gradle")
13+
514
java {
615
sourceCompatibility = JavaVersion.VERSION_11
716
targetCompatibility = JavaVersion.VERSION_11

0 commit comments

Comments
 (0)