-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (43 loc) · 1.39 KB
/
android.yml
File metadata and controls
55 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Android CI-CD
on:
push:
branches:
- development
jobs:
build:
name: Build Debug APK
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/development' && github.event_name == 'push'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant Execute Permission to Gradle Wrapper
run: chmod +x ./gradlew
- name: Build Debug APK
run: ./gradlew bundleDebug
- name: Get Branch Type and Rename APK
run: |
RAW_BRANCH="${GITHUB_REF##*/}"
if [[ "$RAW_BRANCH" == "main" ]]; then
SHORT_NAME="main"
elif [[ "$RAW_BRANCH" == "development" ]]; then
SHORT_NAME="dev"
else
SHORT_NAME="feature"
fi
FINAL_NAME="app_${SHORT_NAME}.apk"
echo "FINAL_NAME=${FINAL_NAME}" >> $GITHUB_ENV
mv app/build/outputs/bundle/debug/app-debug.apk \
app/build/outputs/bundle/debug/${FINAL_NAME}
echo "RENAMED_AAB_PATH=app/build/outputs/bundle/debug/${FINAL_NAME}" >> $GITHUB_ENV
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: ${{ env.FINAL_NAME }}
path: ${{ env.RENAMED_AAB_PATH }}