diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c113fc..9753a61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Check Commit CI +name: CI on: push: @@ -14,9 +14,24 @@ concurrency: cancel-in-progress: false jobs: - build: + job-common: + runs-on: ubuntu-latest + outputs: + SHORT_SHA: ${{ steps.expose_sha.outputs.short_sha }} + steps: + - name: expose short commit sha + id: expose_sha + run: | + SHORT_SHA=${GITHUB_SHA::7} + echo "short_sha=$SHORT_SHA" >> $GITHUB_ENV + echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT + + build-android: + needs: job-common runs-on: ubuntu-latest timeout-minutes: 60 + env: + SHORT_SHA: ${{ needs.job-common.outputs.SHORT_SHA }} steps: - name: checkout repo uses: actions/checkout@v4 @@ -30,7 +45,7 @@ jobs: java-version: '21' - name: cache gradle dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.gradle/caches key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }} @@ -70,20 +85,10 @@ jobs: VERSION_CODE=$(./gradlew printVersionCode -q) echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV - - name: list all apk files - run: | - echo "APKs:" - for apk in $(find composeApp/build/outputs/apk -name '*.apk'); do - echo "$apk" - done - - name: expose apk path run: | echo "APK_PATH=$(find composeApp/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 }} diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 594a46d..83c7549 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -107,7 +107,6 @@ android { targetSdk = libs.versions.target.sdk.get().toInt() versionName = "1.0.0" versionCode = gitCommitsCount - setProperty("archivesBaseName", "KmpTemplate-v$versionName($versionCode)") } packaging { resources { @@ -154,6 +153,10 @@ compose { } } +base { + archivesName.set("KmpTemplate-v${android.defaultConfig.versionName}(${android.defaultConfig.versionCode})") +} + tasks.register("printVersionName") { doLast { println(android.defaultConfig.versionName) diff --git a/composeApp/src/androidMain/res/values/strings.xml b/composeApp/src/androidMain/res/values/strings.xml index e14e45d..d02d321 100644 --- a/composeApp/src/androidMain/res/values/strings.xml +++ b/composeApp/src/androidMain/res/values/strings.xml @@ -1,3 +1,3 @@ - kmp-template + KmpTemplate \ No newline at end of file