Skip to content

Commit 197dc28

Browse files
authored
Create android.yml
1 parent c2e4a61 commit 197dc28

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/android.yml

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

0 commit comments

Comments
 (0)