1
- # Create android release AAB
2
- name : Android - Build
1
+ # Reusable action to generate an android app from another repo
2
+ # containing bundled web code
3
+ name : Android Build
3
4
on :
4
5
workflow_call :
5
6
inputs :
6
7
dist-path :
7
8
description : path to folder containing code to include in app. Omit if code not in a subfolder
8
9
type : string
10
+ icon-path :
11
+ description : path to a png image image to use for android icon
12
+ type : string
13
+ app-name :
14
+ description : name of app to display on android device
15
+ type : string
16
+ default : Programming Club
17
+ app-id :
18
+ description : identifier of app for use on android device
19
+ type : string
20
+ default : club.programming.app
9
21
jobs :
10
22
android_build :
11
23
runs-on : ubuntu-latest
23
35
sparse-checkout : ${{ inputs.dist-path }}
24
36
sparse-checkout-cone-mode : false
25
37
26
- - name : Move repo code in nested folder
27
- if : ${{ inputs.dist-path }}
28
- run : mv dist/${{ inputs.dist-path }}/* dist
29
-
30
- - name : Debug checkout files
31
- run : |
32
- echo $(ls)
33
- echo $(ls dist)
34
-
35
38
- name : Setup Node
36
39
uses : actions/setup-node@v4
37
40
with :
@@ -42,12 +45,28 @@ jobs:
42
45
- name : Install dependencies
43
46
run : npm ci
44
47
45
- # TODO - generate assets
46
- # TODO - allow capacitor overrides
48
+ # If the exernal repo code is already in a folder, e.g. `build/index.html`, then it will be populated
49
+ # with the extra top-level folder, `dist/build/index.html`. Move all subfolder files one level higher
50
+ - name : Move repo code in nested folder
51
+ if : ${{ inputs.dist-path }}
52
+ run : mv dist/${{ inputs.dist-path }}/* dist
53
+
54
+ - name : Add app icon
55
+ if : ${{ inputs.icon-path }}
56
+ run : |
57
+ mkdir assets
58
+ cp dist/${{ inputs.icon-path }} assets/icon.png
59
+ npx capacitor-assets generate --android
60
+
61
+ - name : Update capacitor config
62
+
63
+ with :
64
+ file : capacitor.config.json
65
+ fields : " {'appId': '${{inputs.app-id}}', 'appName': '${{inputs.app-name}}'}"
66
+
47
67
- name : Add android platform
48
68
run : npx cap add android
49
69
50
- # Re-sync as remote cache won't populate files during nx build command
51
70
- name : Sync Capacitor
52
71
run : npx cap sync
53
72
70
89
with :
71
90
name : android
72
91
path : ./android/app/build/outputs/apk/debug/app-debug.apk
73
-
74
- # - name: Build Android Release Bundle
75
- # working-directory: ./android
76
- # run: ./gradlew :app:bundleRelease
0 commit comments