Skip to content

Commit ec3b832

Browse files
committed
Update project
1 parent 9aa9a0a commit ec3b832

2 files changed

Lines changed: 38 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ jobs:
3232
timeout-minutes: 60
3333
env:
3434
SHORT_SHA: ${{ needs.job-common.outputs.SHORT_SHA }}
35-
outputs:
36-
VERSION_NAME: ${{ steps.version.outputs.VERSION_NAME }}
37-
VERSION_CODE: ${{ steps.version.outputs.VERSION_CODE }}
3835
steps:
3936
- name: checkout repo
4037
uses: actions/checkout@v4
@@ -46,25 +43,49 @@ jobs:
4643
with:
4744
distribution: 'temurin'
4845
java-version: '21'
49-
cache: gradle
5046

51-
- name: expose version
52-
id: version
53-
run: ./gradlew -q printVersion | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT
47+
- name: cache gradle dependencies
48+
uses: actions/cache@v4
49+
with:
50+
path: ~/.gradle/caches
51+
key: gradle-${{ runner.os }}-${{ hashFiles('/*.gradle*', '/gradle-wrapper.properties') }}
52+
restore-keys: |
53+
gradle-${{ runner.os }}-
5454
55-
- uses: gradle/actions/setup-gradle@v4
55+
- name: cache gradle wrapper
56+
uses: actions/cache@v3
5657
with:
57-
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
58-
cache-write: true
58+
path: ~/.gradle/wrapper
59+
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
60+
61+
- name: clean outputs directory
62+
run: rm -rf app/build/outputs/*
63+
64+
- name: make gradlew executable
65+
run: chmod +x ./gradlew
5966

60-
- run: ./gradlew assembleDebug
67+
- name: assemble debug artifact
68+
run: ./gradlew assembleDebug
6169

62-
- uses: actions/upload-artifact@v4
70+
- name: upload artifacts to outputs
71+
uses: actions/upload-artifact@v4
6372
with:
64-
path: app/build/outputs/apk
65-
retention-days: 1
73+
path: |
74+
app/build/outputs/apk
75+
76+
- name: expose version name
77+
id: version_name
78+
run: |
79+
VERSION_NAME=$(./gradlew printVersionName -q)
80+
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
81+
82+
- name: expose version code
83+
id: version_code
84+
run: |
85+
VERSION_CODE=$(./gradlew printVersionCode -q)
86+
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
6687
67-
- name: expose debug apk path
88+
- name: expose apk path
6889
run: |
6990
echo "APK_PATH=$(find app/build/outputs/apk -name '*.apk' -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -d' ' -f2)" >> $GITHUB_ENV
7091

app/build.gradle.kts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,5 @@ dependencies {
5353
api(libs.androidx.core.splashscreen)
5454
}
5555

56-
tasks.register("printVersion") {
57-
doLast {
58-
println("VERSION_NAME=${android.defaultConfig.versionName}")
59-
println("VERSION_CODE=${android.defaultConfig.versionCode}")
60-
}
61-
}
56+
tasks.register("printVersionName") { doLast { println(android.defaultConfig.versionName) } }
57+
tasks.register("printVersionCode") { doLast { println(android.defaultConfig.versionCode.toString()) } }

0 commit comments

Comments
 (0)