-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.39 KB
/
android-docker.yml
File metadata and controls
46 lines (40 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
name: Android CI with Docker
on:
push:
branches: [ "main", "feat/*", "feature/*" ]
pull_request:
branches: [ "main" ]
jobs:
build-in-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker Image
run: docker build -t android-ci .
- name: Determine Build Target
id: target
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "TASK=assembleRelease" >> $GITHUB_OUTPUT
echo "APK_PATH=app/build/outputs/apk/release/app-release-unsigned.apk" >> $GITHUB_OUTPUT
echo "ARTIFACT_NAME=app-release" >> $GITHUB_OUTPUT
else
echo "TASK=assembleDebug" >> $GITHUB_OUTPUT
echo "APK_PATH=app/build/outputs/apk/debug/app-debug.apk" >> $GITHUB_OUTPUT
echo "ARTIFACT_NAME=app-debug" >> $GITHUB_OUTPUT
fi
- name: Run Gradle Build in Docker
# Mount current directory to /app
# Use the image built in previous step
# Run './gradlew <task>'
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
-w /app \
android-ci \
bash -c "chmod +x gradlew && ./gradlew ${{ steps.target.outputs.TASK }}"
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: ${{ steps.target.outputs.ARTIFACT_NAME }}
path: ${{ steps.target.outputs.APK_PATH }}