-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 2.01 KB
/
android-build.yml
File metadata and controls
67 lines (54 loc) · 2.01 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
56
57
58
59
60
61
62
63
64
65
66
67
# GitHub Actions workflow to build an Android APK for The-Loop
# Save this file as .github/workflows/android-build.yml in your repo
# It will produce an unsigned debug APK and upload it as a workflow artifact.
name: Build Android APK
on:
push:
branches: [ main, 2.0 ]
pull_request:
branches: [ main, 2.0 ]
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
# optimized action for gradle caching and distribution
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# This action instantly configures the path to the pre-installed SDK
# It takes seconds, whereas downloading manually takes minutes.
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install Android SDK Packages
run: |
yes | sdkmanager --licenses
sdkmanager "platforms;android-34" "build-tools;34.0.0"
- name: Build debug APK
run: ./gradlew assembleDebug --no-daemon
- name: Rename APK with version
run: |
# Extract version name from build.gradle
VERSION_NAME=$(grep "versionName" app/build.gradle | head -n1 | awk '{print $2}' | tr -d '"')
echo "Detected version: $VERSION_NAME"
# Find the generated APK
APK_PATH=$(find app/build/outputs/apk/debug -name "app-debug.apk" -print -quit)
if [ -n "$APK_PATH" ]; then
NEW_NAME="app/build/outputs/apk/debug/TheLoop-v${VERSION_NAME}-debug.apk"
mv "$APK_PATH" "$NEW_NAME"
echo "Renamed APK to: $NEW_NAME"
else
echo "APK not found!"
exit 1
fi
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: the-loop-debug-apk
path: app/build/outputs/apk/debug/TheLoop-*.apk