Skip to content

Commit 6b5ebdf

Browse files
authored
Feat/android build icon (#3)
1 parent 438ff1d commit 6b5ebdf

File tree

4 files changed

+39
-22
lines changed

4 files changed

+39
-22
lines changed

.github/workflows/android-build.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
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
34
on:
45
workflow_call:
56
inputs:
67
dist-path:
78
description: path to folder containing code to include in app. Omit if code not in a subfolder
89
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
921
jobs:
1022
android_build:
1123
runs-on: ubuntu-latest
@@ -23,15 +35,6 @@ jobs:
2335
sparse-checkout: ${{ inputs.dist-path }}
2436
sparse-checkout-cone-mode: false
2537

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-
3538
- name: Setup Node
3639
uses: actions/setup-node@v4
3740
with:
@@ -42,12 +45,28 @@ jobs:
4245
- name: Install dependencies
4346
run: npm ci
4447

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+
uses: restackio/[email protected]
63+
with:
64+
file: capacitor.config.json
65+
fields: "{'appId': '${{inputs.app-id}}', 'appName': '${{inputs.app-name}}'}"
66+
4767
- name: Add android platform
4868
run: npx cap add android
4969

50-
# Re-sync as remote cache won't populate files during nx build command
5170
- name: Sync Capacitor
5271
run: npx cap sync
5372

@@ -70,7 +89,3 @@ jobs:
7089
with:
7190
name: android
7291
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

.github/workflows/test-android-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Test call of reusable workflow
2-
name: Test Android Build
1+
name: Demo Android Build
32
on:
43
workflow_dispatch:
54
push:
@@ -10,3 +9,6 @@ jobs:
109
uses: supportingami/programming-club-builder/.github/workflows/android-build.yml@main
1110
with:
1211
dist-path: demo
12+
icon-path: logo.png
13+
app-name: Programming Club Demo
14+
app-id: club.programming.app

capacitor.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"appId": "com.example.app",
3-
"appName": "programming-club",
2+
"appId": "club.programming.app",
3+
"appName": "Programming Club",
44
"webDir": "dist",
55
"plugins": {
66
"SplashScreen": {
File renamed without changes.

0 commit comments

Comments
 (0)