-
Notifications
You must be signed in to change notification settings - Fork 25
123 lines (102 loc) · 3.22 KB
/
android.yml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Android Build
on:
pull_request:
branches: [main, android]
types: [opened, synchronize, reopened]
push:
branches: [main, android]
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Diagnose project structure
run: |
echo "Current directory:"
pwd
echo "Directory contents:"
ls -R
echo "Searching for gradlew:"
find . -name gradlew
- name: Set Gradle Wrapper Permissions
run: |
GRADLEW_PATH=$(find . -name gradlew | head -n 1)
if [ -z "$GRADLEW_PATH" ]; then
echo "gradlew not found. Exiting."
exit 1
fi
chmod +x $GRADLEW_PATH
echo "GRADLEW_PATH=$GRADLEW_PATH" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build gradle project
run: ${{ env.GRADLEW_PATH }} build
- name: Build debug APK
run: ${{ env.GRADLEW_PATH }} assembleDebug
- name: Upload debug APK
uses: actions/upload-artifact@v3
with:
name: app-debug
path: '**/build/outputs/apk/debug/*.apk'
# release:
# needs: build
# if: github.event_name == 'release' && github.event.action == 'created'
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# - name: Set up JDK
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Change directory
# run: cd android
# - name: Setup Android SDK
# uses: android-actions/setup-android@v2
# - name: Cache Gradle packages
# uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Change wrapper permissions
# run: chmod +x ./gradlew
# - name: Build release APK
# run: ./gradlew assembleRelease
# - name: Upload release APK
# uses: actions/upload-artifact@v3
# with:
# name: app-release
# path: app/build/outputs/apk/release/app-release-unsigned.apk
# - name: Upload release APK to GitHub release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: app/build/outputs/apk/release/app-release-unsigned.apk
# asset_name: app-release-${{ github.ref_name }}.apk
# asset_content_type: application/vnd.android.package-archive