Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/apk-s3-distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,32 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: GetStream/android-ci-actions/actions/setup-java@cb46e4f44d105a68738bfd2a1cfd156bb768665b
- name: Resolve build identity
id: build_identity
run: |
# Minutes since 2020-09-13. The same package is published from more than one branch,
# so the version code has to grow with build time. A per-branch commit count can go
# backwards and Android rejects that as a downgrade.
{
echo "version_code=$(( ($(date -u +%s) - 1600000000) / 60 ))"
echo "sha=$(git rev-parse --short=7 HEAD)"
} >> "$GITHUB_OUTPUT"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- name: Prepare environment
env:
PASSPHRASE: ${{ secrets.PASSPHRASE }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PROPERTIES: ${{ secrets.RELEASE_KEYSTORE_PROPERTIES }}
run: |
git fetch --unshallow
echo "${{ env.RELEASE_KEYSTORE }}" > .sign/release.keystore.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/release.keystore.asc > .sign/release.keystore
echo "${{ env.RELEASE_KEYSTORE_PROPERTIES }}" > .sign/keystore.properties.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/keystore.properties.asc > .sign/keystore.properties
- name: Assemble
run: ./gradlew :stream-chat-android-ui-components-sample:assembleDemoRelease --stacktrace
run: |
./gradlew :stream-chat-android-ui-components-sample:assembleDemoRelease \
-PsampleAppVersionCode=${{ steps.build_identity.outputs.version_code }} \
-PsampleAppBuildSha=${{ steps.build_identity.outputs.sha }} \
--stacktrace
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/app-distribute-v7.yml

This file was deleted.

64 changes: 55 additions & 9 deletions .github/workflows/app-distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,40 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: GetStream/android-ci-actions/actions/setup-java@cb46e4f44d105a68738bfd2a1cfd156bb768665b
- name: Resolve build identity
Comment thread
gpunto marked this conversation as resolved.
id: build_identity
run: |
# Minutes since 2020-09-13. The same package is published from more than one branch,
# so the version code has to grow with build time. A per-branch commit count can go
# backwards and Android rejects that as a downgrade.
{
echo "version_code=$(( ($(date -u +%s) - 1600000000) / 60 ))"
echo "sha=$(git rev-parse --short=7 HEAD)"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
} >> "$GITHUB_OUTPUT"
- name: Write release notes
run: |
{
git log -1 --pretty=%s
echo
echo "Commit: ${{ github.sha }}"
echo "Build: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} > release-notes.txt
- name: Prepare environment
env:
PASSPHRASE: ${{ secrets.PASSPHRASE }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PROPERTIES: ${{ secrets.RELEASE_KEYSTORE_PROPERTIES }}
run: |
git fetch --unshallow
echo "${{ env.RELEASE_KEYSTORE }}" > .sign/release.keystore.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/release.keystore.asc > .sign/release.keystore
echo "${{ env.RELEASE_KEYSTORE_PROPERTIES }}" > .sign/keystore.properties.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/keystore.properties.asc > .sign/keystore.properties
- name: Assemble
run: bash ./gradlew :stream-chat-android-ui-components-sample:assembleDemoRelease --stacktrace
run: |
bash ./gradlew :stream-chat-android-ui-components-sample:assembleDemoRelease \
-PsampleAppVersionCode=${{ steps.build_identity.outputs.version_code }} \
-PsampleAppBuildSha=${{ steps.build_identity.outputs.sha }} \
--stacktrace
- name: Upload APK
uses: actions/upload-artifact@v7.0.1
with:
Expand All @@ -37,10 +58,12 @@ jobs:
- name: Upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.1
with:
appId: ${{secrets.FIREBASE_UI_SAMPLE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
# io.getstream.chat.ui.sample in the stream-android-32afb project
appId: "1:17048947178:android:1357755d7b622cbc40ca93"
serviceCredentialsFileContent: ${{ secrets.STREAM_ANDROID_FIREBASE_CREDENTIALS_APP_CONTENT }}
groups: stream-testers
file: stream-chat-android-ui-components-sample/build/outputs/apk/demo/release/stream-chat-android-ui-components-sample-demo-release.apk
releaseNotesFile: release-notes.txt
build_compose_sample_app:
permissions:
actions: write
Expand All @@ -50,28 +73,51 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: GetStream/android-ci-actions/actions/setup-java@cb46e4f44d105a68738bfd2a1cfd156bb768665b
- name: Resolve build identity
id: build_identity
run: |
# Minutes since 2020-09-13. The same package is published from more than one branch,
# so the version code has to grow with build time. A per-branch commit count can go
# backwards and Android rejects that as a downgrade.
{
echo "version_code=$(( ($(date -u +%s) - 1600000000) / 60 ))"
echo "sha=$(git rev-parse --short=7 HEAD)"
} >> "$GITHUB_OUTPUT"
- name: Write release notes
run: |
{
git log -1 --pretty=%s
echo
echo "Commit: ${{ github.sha }}"
echo "Build: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
} > release-notes.txt
- name: Prepare environment
env:
PASSPHRASE: ${{ secrets.PASSPHRASE }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PROPERTIES: ${{ secrets.RELEASE_KEYSTORE_PROPERTIES }}
run: |
git fetch --unshallow
echo "${{ env.RELEASE_KEYSTORE }}" > .sign/release.keystore.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/release.keystore.asc > .sign/release.keystore
echo "${{ env.RELEASE_KEYSTORE_PROPERTIES }}" > .sign/keystore.properties.asc
gpg -d --passphrase "${{ env.PASSPHRASE }}" --batch .sign/keystore.properties.asc > .sign/keystore.properties
- name: Assemble
run: bash ./gradlew :stream-chat-android-compose-sample:assembleRelease --stacktrace
run: |
bash ./gradlew :stream-chat-android-compose-sample:assembleRelease \
-PsampleAppVersionCode=${{ steps.build_identity.outputs.version_code }} \
-PsampleAppBuildSha=${{ steps.build_identity.outputs.sha }} \
--stacktrace
- name: Upload APK
uses: actions/upload-artifact@v7.0.1
with:
Comment thread
gpunto marked this conversation as resolved.
name: stream-chat-android-compose-sample-release
path: stream-chat-android-compose-sample/build/outputs/apk/release/
path: stream-chat-android-compose-sample/build/outputs/apk/demo/release/
- name: Upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.1
with:
appId: ${{secrets.FIREBASE_COMPOSE_SAMPLE_APP_ID}}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
# io.getstream.chat.android.compose.sample in the stream-android-32afb project
appId: "1:17048947178:android:07dc1e8e56b65c1f40ca93"
serviceCredentialsFileContent: ${{ secrets.STREAM_ANDROID_FIREBASE_CREDENTIALS_APP_CONTENT }}
groups: stream-testers
file: stream-chat-android-compose-sample/build/outputs/apk/demo/release/stream-chat-android-compose-sample-demo-release.apk
releaseNotesFile: release-notes.txt
17 changes: 15 additions & 2 deletions .github/workflows/attach-release-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ jobs:
- uses: actions/checkout@v7.0.1
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
persist-credentials: false
- uses: GetStream/android-ci-actions/actions/setup-java@main
- name: Resolve build identity
id: build_identity
run: |
# Minutes since 2020-09-13. The same package is published from more than one branch,
# so the version code has to grow with build time. A per-branch commit count can go
# backwards and Android rejects that as a downgrade.
{
echo "version_code=$(( ($(date -u +%s) - 1600000000) / 60 ))"
echo "sha=$(git rev-parse --short=7 HEAD)"
} >> "$GITHUB_OUTPUT"
- name: Prepare signing environment
env:
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
Expand All @@ -33,7 +42,11 @@ jobs:
echo "$RELEASE_KEYSTORE_PROPERTIES" > .sign/keystore.properties.asc
gpg -d --passphrase "$PASSPHRASE" --batch .sign/keystore.properties.asc > .sign/keystore.properties
- name: Assemble Compose sample (demo/release)
run: bash ./gradlew :stream-chat-android-compose-sample:assembleDemoRelease --stacktrace
run: |
bash ./gradlew :stream-chat-android-compose-sample:assembleDemoRelease \
-PsampleAppVersionCode=${{ steps.build_identity.outputs.version_code }} \
-PsampleAppBuildSha=${{ steps.build_identity.outputs.sha }} \
--stacktrace
- name: Attach APK to release under a constant name
env:
GH_TOKEN: ${{ github.token }}
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ plugins {
alias(libs.plugins.detekt) apply false
alias(libs.plugins.shot) apply false
alias(libs.plugins.androidx.navigation) apply false
alias(libs.plugins.gitversioner)
alias(libs.plugins.gradle.versions)
alias(libs.plugins.binary.compatibility.validator)
}
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ firebaseAnalytics = "22.1.2"
firebaseCrashlytics = "19.2.1"
firebaseCrashlyticsPlugin = "3.0.2"
firebaseMessaging = "24.1.0"
gitversioner = "0.5.0"
googleServices = "4.4.2"
gradleVersionsPlugin = "0.51.0"
huaweiPush = "6.11.0.300"
Expand Down Expand Up @@ -232,7 +231,6 @@ androidx-navigation = { id = "androidx.navigation.safeargs.kotlin", version.ref
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinBinaryValidator"}
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detektPlugin"}
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin"}
gitversioner = { id = "com.pascalwelsch.gitversioner", version.ref = "gitversioner"}
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices"}
gradle-versions = { id = "com.github.ben-manes.versions", version.ref = "gradleVersionsPlugin"}
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"}
Expand Down
34 changes: 11 additions & 23 deletions scripts/sample-app-versioner.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
static Boolean gitIsAvailable() {
try {
"git --version".execute()
return true
} catch (Throwable ignored) {
return false
}
}
def isCI = System.getenv('CI')
ext["sampleAppVersionCode"] = 1
ext["sampleAppVersionName"] = version
if (isCI && gitIsAvailable()) {
gitVersioner {
def branches = ['develop', 'main', 'release']
baseBranch branchName in branches ? branchName : branches[0]
yearFactor 100
formatter = { gitVersioner ->
"1.${gitVersioner.versionCode}.${gitVersioner.featureBranchCommitCount}.${gitVersioner.currentSha1Short}"
}
}
// CI passes these so that every published sample build is a distinct, newer release.
//
// The version code is minutes since a fixed epoch rather than a commit count. The same
// package is published from both develop and main, their commit counts diverge, and Android
// rejects an install whose version code went backwards.
//
// Without the properties the samples keep the fixed values they had before.
def sdkVersion = version.toString()
def buildSha = findProperty("sampleAppBuildSha")

ext["sampleAppVersionCode"] = gitVersioner.versionCode
ext["sampleAppVersionName"] = gitVersioner.versionName
}
ext["sampleAppVersionCode"] = (findProperty("sampleAppVersionCode") ?: "1") as Integer
Comment thread
gpunto marked this conversation as resolved.
ext["sampleAppVersionName"] = buildSha ? "$sdkVersion-$buildSha".toString() : sdkVersion
Comment thread
coderabbitai[bot] marked this conversation as resolved.
7 changes: 0 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ pluginManagement {
}
}

maven(url = "https://jitpack.io/") {
content {
includeModule("com.github.passsy", "gradle-gitVersioner-plugin")
}
}

// fetch plugins from gradle plugin portal (https://plugins.gradle.org)
gradlePluginPortal()

Expand All @@ -37,7 +31,6 @@ pluginManagement {
eachPlugin {
when(requested.id.id) {
"shot" -> { useModule("com.karumi:shot:${requested.version}") }
"com.pascalwelsch.gitversioner" -> { useModule("com.github.passsy:gradle-gitVersioner-plugin:${requested.version}") }
}
}
}
Expand Down
Loading