Skip to content

Commit c66cd79

Browse files
binarynoiseCopilot
andcommitted
Refactor CI to upload APKs individually as artifacts using matrix
Co-authored-by: GitHub Copilot <[email protected]>
1 parent ee08501 commit c66cd79

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,3 +465,7 @@ ij_markdown_min_lines_around_header = 1
465465
ij_markdown_min_lines_between_paragraphs = 1
466466
ij_markdown_wrap_text_if_long = true
467467
ij_markdown_wrap_text_inside_blockquotes = true
468+
469+
[{*.yaml,*.yml}]
470+
indent_size = 2
471+
ij_yaml_indent_sequence_value = false

.github/workflows/ci.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
name: Build & Upload APKs
12

23
on:
34
push:
45

6+
permissions:
7+
contents: read
8+
59
jobs:
610
build:
711
runs-on: ubuntu-latest
812
steps:
9-
1013
- name: Setup Java
1114
uses: actions/setup-java@v4
1215
with:
@@ -34,8 +37,43 @@ jobs:
3437
- name: Compile
3538
run: ./gradlew assembleDebug
3639

37-
- name: Upload Result
40+
- name: Upload Result (all APKs)
3841
uses: actions/upload-artifact@v4
3942
with:
43+
name: all-apks.zip
4044
path: '*/build/outputs/apk/debug/*-debug.apk'
4145
if-no-files-found: error
46+
47+
- name: Find APKs and set matrix
48+
id: find_apks
49+
run: |
50+
set -euo pipefail
51+
apks=$(find . -type f -path "*/build/outputs/apk/debug/*-debug.apk" -printf '{"path":"%p","name":"%f"},' | sed 's/,$//' | awk '{print "[" $0 "]"}')
52+
if [ -z "$apks" ] || [ "$apks" = "[]" ]; then
53+
echo "No APKs found!"
54+
exit 1
55+
fi
56+
echo "artifact_paths=$apks" >> $GITHUB_OUTPUT
57+
cat $GITHUB_OUTPUT
58+
59+
outputs:
60+
artifact-paths: ${{ steps.find_apks.outputs.artifact_paths }}
61+
62+
upload_individual_apks:
63+
needs: build
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
apk: ${{ fromJson(needs.build.outputs.artifact-paths) }}
68+
steps:
69+
- name: Download all-apks artifact
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: all-apks.zip
73+
74+
- name: Upload single APK
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: ${{ matrix.apk.name }}
78+
path: ${{ matrix.apk.path }}
79+
if-no-files-found: error

0 commit comments

Comments
 (0)