-
Notifications
You must be signed in to change notification settings - Fork 7
80 lines (68 loc) · 1.94 KB
/
ci.yml
File metadata and controls
80 lines (68 loc) · 1.94 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
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build & Upload APKs
on:
push:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Cache Gradle
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-cache-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
restore-keys: gradle-cache-
- name: Prepare files
run: |
chmod +x gradlew
- name: Compile
run: ./gradlew assembleDebug
- name: Upload Result (all APKs)
uses: actions/upload-artifact@v7
with:
name: all-apks.zip
path: '*/build/outputs/apk/debug/*-debug.apk'
if-no-files-found: error
- name: Find APKs and set matrix
id: find_apks
run: |
set -euo pipefail
apks=$(find . -type f -path "*/build/outputs/apk/debug/*-debug.apk" -printf '{"path":"%p","name":"%f"},' | sed 's/,$//' | awk '{print "[" $0 "]"}')
if [ -z "$apks" ] || [ "$apks" = "[]" ]; then
echo "No APKs found!"
exit 1
fi
echo "artifact_paths=$apks" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
outputs:
artifact-paths: ${{ steps.find_apks.outputs.artifact_paths }}
upload_individual_apks:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
apk: ${{ fromJson(needs.build.outputs.artifact-paths) }}
steps:
- name: Download all-apks artifact
uses: actions/download-artifact@v8
with:
name: all-apks.zip
- name: Upload single APK
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.apk.name }}
path: ${{ matrix.apk.path }}
archive: false
if-no-files-found: error