Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/gradle/org.jetbrains.androidx.…
Browse files Browse the repository at this point in the history
…navigation-navigation-compose-2.8.0-alpha10
  • Loading branch information
michaelbel authored Nov 16, 2024
2 parents d0ef0cd + 0903eac commit 9fd0542
Show file tree
Hide file tree
Showing 129 changed files with 959 additions and 1,705 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Check PR

on:
pull_request:
branches:
'**'
paths-ignore:
- '**.md'
- '.idea/**'
- '.github/**'
# pull_request:
# branches:
# '**'
# paths-ignore:
# - '**.md'
# - '.idea/**'
# - '.github/**'
workflow_dispatch:

concurrency:
Expand All @@ -33,11 +33,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/[email protected]
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Check Commit CI

on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:

concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
TMDB_API_KEY: ${{ secrets.TMDB_API_KEY }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: setup jdk 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: cache gradle dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: cache gradle wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: clean outputs directory
run: rm -rf app/build/outputs/*

- name: make gradlew executable
run: chmod +x ./gradlew

- name: decode keystore file
id: decode_keystore_file
uses: timheuer/base64-to-file@v1
with:
fileName: 'keystore_release.jks'
encodedString: ${{ secrets.KEYSTORE_FILE }}

- name: set decoded file location as environment
run: echo "KEYSTORE_FILE=${{ steps.decode_keystore_file.outputs.filePath }}" >> $GITHUB_ENV

- name: assemble gms debug artifact
run: ./gradlew androidApp:assembleGmsDebug

# - name: assemble hms debug artifact
# run: ./gradlew androidApp:assembleHmsDebug

# - name: assemble foss debug artifact
# run: ./gradlew androidApp:assembleFossDebug

# - name: assemble gms release artifact
# run: ./gradlew androidApp:assembleGmsRelease

# - name: assemble hms release artifact
# run: ./gradlew androidApp:assembleHmsRelease

# - name: assemble foss release artifact
# run: ./gradlew androidApp:assembleFossRelease

- name: upload artifacts to outputs
uses: actions/upload-artifact@v4
with:
path: |
androidApp/build/outputs/apk
- name: expose version name
id: version_name
run: |
VERSION_NAME=$(./gradlew printVersionName -q)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
- name: expose version code
id: version_code
run: |
VERSION_CODE=$(./gradlew printVersionCode -q)
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
- name: list all apk files
run: |
echo "APKs:"
for apk in $(find androidApp/build/outputs/apk -name '*.apk'); do
echo "$apk"
done
- name: expose apk path
run: |
echo "APK_PATH=$(find androidApp/build/outputs/apk -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
- name: expose short commit sha
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: send telegram message
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
THREAD_ID: ${{ secrets.TELEGRAM_THREAD_ID }}
MESSAGE: |
✅ <b>${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }})</b>
<b>Ветка:</b> ${{ github.ref_name }}
<b>Коммит:</b> <code>${{ env.SHORT_SHA }}</code>
run: |
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendDocument" \
-F chat_id="${CHAT_ID}" \
-F document="@${{ env.APK_PATH }}" \
-F caption="${{ env.MESSAGE }}" \
-F message_thread_id="${THREAD_ID}" \
-F parse_mode="HTML"
22 changes: 11 additions & 11 deletions .github/workflows/distribution_app.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Distribution App

on:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'
- '.idea/**'
- '.github/**'
- 'config/**'
# push:
# branches:
# - master
# - develop
# paths-ignore:
# - '**.md'
# - '.idea/**'
# - '.github/**'
# - 'config/**'
workflow_dispatch:

env:
Expand All @@ -34,11 +34,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Make Gradlew Executable
run: chmod +x ./gradlew
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release

on:
push:
tags:
- '*'
# push:
# tags:
# - '*'
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .run/iosApp.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iosApp" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" EXEC_TARGET_ID="D471F79B-CC8F-4B86-8CBE-6AD86EC4DB25" XCODE_PROJECT="$PROJECT_DIR$/iosApp/iosApp.xcodeproj" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="iosApp">
<configuration default="false" name="iosApp" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" EXEC_TARGET_ID="3AE3B360-C46D-4989-9B2E-EBC66F72DD3E" XCODE_PROJECT="$PROJECT_DIR$/iosApp/iosApp.xcodeproj" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="iosApp">
<method v="2">
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
</method>
Expand Down
60 changes: 36 additions & 24 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import com.google.firebase.appdistribution.gradle.AppDistributionExtension
import org.apache.commons.io.output.ByteArrayOutputStream
import org.jetbrains.kotlin.konan.properties.Properties
import java.io.FileInputStream
import java.nio.charset.Charset

@Suppress("dsl_scope_violation")

plugins {
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.androidx.navigation.safeargs)
alias(libs.plugins.palantir.git)
}

private val gitCommitsCount by lazy {
private val gitCommitsCount: Int by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
exec {
commandLine("git", "rev-list", "--count", "HEAD")
standardOutput = stdout
}
stdout.toString().trim().toInt()
stdout.toString(Charset.defaultCharset()).trim().toInt()
}

val currentTime by lazy {
Expand All @@ -30,35 +30,17 @@ val gitVersion: groovy.lang.Closure<String> by extra
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val versionLastTag: String = versionDetails().lastTag

tasks.register("prepareReleaseNotes") {
doLast {
exec {
workingDir(rootDir)
executable("./config/scripts/gitlog.sh")
}
}
}

afterEvaluate {
tasks.findByName("assembleGmsDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleGmsRelease")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleHmsDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleHmsRelease")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleFossDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleFossRelease")?.finalizedBy("prepareReleaseNotes")
}

android {
namespace = "org.michaelbel.movies.app"
compileSdk = libs.versions.compile.sdk.get().toInt()
flavorDimensions += "version"

defaultConfig {
applicationId = "org.michaelbel.moviemade"
minSdk = libs.versions.min.sdk.get().toInt()
compileSdk = libs.versions.compile.sdk.get().toInt()
targetSdk = libs.versions.target.sdk.get().toInt()
versionCode = gitCommitsCount
versionName = "2.0.0"
versionCode = gitCommitsCount
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
resourceConfigurations.addAll(listOf("en", "ru"))
Expand Down Expand Up @@ -193,4 +175,34 @@ val hasHmsBenchmark = gradle.startParameter.taskNames.any { it.contains("HmsBenc

if (hasHmsDebug || hasHmsRelease || hasHmsBenchmark) {
//apply(plugin = libs.plugins.huawei.services.get().pluginId)
}

tasks.register("prepareReleaseNotes") {
doLast {
exec {
workingDir(rootDir)
executable("./config/scripts/gitlog.sh")
}
}
}

tasks.register("printVersionName") {
doLast {
println(android.defaultConfig.versionName)
}
}

tasks.register("printVersionCode") {
doLast {
println(android.defaultConfig.versionCode.toString())
}
}

afterEvaluate {
tasks.findByName("assembleGmsDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleGmsRelease")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleHmsDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleHmsRelease")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleFossDebug")?.finalizedBy("prepareReleaseNotes")
tasks.findByName("assembleFossRelease")?.finalizedBy("prepareReleaseNotes")
}
Loading

0 comments on commit 9fd0542

Please sign in to comment.