Skip to content

Commit 36eb309

Browse files
authored
android: Build aab-file on new release (git tag)
1 parent ae087ab commit 36eb309

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

.github/workflows/client.yml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ on:
99
- "package.json"
1010
- "bun.lock"
1111
workflow_call:
12+
inputs:
13+
build_aab:
14+
description: "Whether to build AAB in addition to APK"
15+
required: false
16+
type: boolean
17+
default: false
1218
outputs:
1319
artifact_name:
1420
description: "The name of the uploaded artifact"
1521
value: ${{ jobs.android_build.outputs.artifact_name }}
1622
apk_filename:
1723
description: "The filename of the APK"
1824
value: ${{ jobs.android_build.outputs.apk_filename }}
25+
aab_filename:
26+
description: "The filename of the AAB"
27+
value: ${{ jobs.android_build.outputs.aab_filename }}
1928

2029
jobs:
2130
lint:
@@ -25,7 +34,7 @@ jobs:
2534
uses: actions/checkout@v4
2635

2736
- name: 📦 Install signet app dependencies
28-
run: nix develop .# --command bash -c "bun install ----frozen-lockfile"
37+
run: nix develop .# --command bash -c "bun install --frozen-lockfile"
2938

3039
- name: ✨ Lint code
3140
run: nix develop .# --command bash -c "bun client lint"
@@ -39,6 +48,7 @@ jobs:
3948
outputs:
4049
artifact_name: ${{ steps.rename_apk.outputs.artifact_name }}
4150
apk_filename: ${{ steps.rename_apk.outputs.apk_filename }}
51+
aab_filename: ${{ steps.aab_meta.outputs.aab_filename }}
4252
steps:
4353
- name: 🏗 Checkout code
4454
uses: actions/checkout@v4
@@ -50,7 +60,7 @@ jobs:
5060
# uses: DeterminateSystems/magic-nix-cache-action@main
5161

5262
- name: 📦 Install signet app dependencies
53-
run: nix develop .# --command bash -c "bun install ----frozen-lockfile"
63+
run: nix develop .# --command bash -c "bun install --frozen-lockfile"
5464

5565
- name: 🔧 Create sentry.properties
5666
env:
@@ -70,12 +80,18 @@ jobs:
7080
MYAPP_RELEASE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
7181
run: ./scripts/create_local_properties.sh
7282

73-
- name: 🔨 Build signet Android app
83+
- name: 🔨 Build signet Android app (APK)
7484
run: nix develop .# --command bash -c "bun client build:android:ci"
7585

76-
- name: 🧹 Clean up keystore
77-
if: always()
78-
run: rm -f client/android/app/release.keystore
86+
- name: 📦 Build signet Android app (AAB)
87+
if: ${{ inputs.build_aab }}
88+
run: nix develop .# --command bash -c "cd client/android && ./gradlew bundleSignetRelease -PreactNativeArchitectures=arm64-v8a"
89+
90+
- name: 🧹 Clean up keystore & local.properties
91+
if: ${{ always() }}
92+
run: |
93+
rm -f client/android/app/release.keystore
94+
rm -f client/android/local.properties
7995
8096
- name: 📝 Rename APK with timestamp
8197
id: rename_apk
@@ -91,8 +107,37 @@ jobs:
91107
echo "apk_filename=${apk_filename}" >> $GITHUB_OUTPUT
92108
shell: bash
93109

110+
- name: 📝 Prepare AAB outputs
111+
id: aab_meta
112+
# Always run so job outputs are defined whether or not we built an AAB
113+
if: ${{ always() }}
114+
shell: bash
115+
run: |
116+
set -euo pipefail
117+
aab_expected="client/android/app/build/outputs/bundle/signetRelease/app-signet-release.aab"
118+
if [[ "${{ inputs.build_aab }}" == 'true' && -f "$aab_expected" ]]; then
119+
timestamp=$(date +'%Y-%m-%d-%H-%M')
120+
aab_filename="noah-android-aab-${timestamp}.aab"
121+
new_aab_path="client/android/app/build/outputs/bundle/signetRelease/${aab_filename}"
122+
mv "$aab_expected" "$new_aab_path"
123+
echo "new_path=${new_aab_path}" >> "$GITHUB_OUTPUT"
124+
echo "aab_filename=${aab_filename}" >> "$GITHUB_OUTPUT"
125+
else
126+
echo "new_path=" >> "$GITHUB_OUTPUT"
127+
echo "aab_filename=" >> "$GITHUB_OUTPUT"
128+
fi
129+
94130
- name: 📤 Upload Android APK
95131
uses: actions/upload-artifact@v4
96132
with:
97133
name: ${{ steps.rename_apk.outputs.artifact_name }}
98134
path: ${{ steps.rename_apk.outputs.new_path }}
135+
if-no-files-found: error
136+
137+
- name: 📤 Upload Android AAB
138+
if: ${{ inputs.build_aab && steps.aab_meta.outputs.new_path != '' }}
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: ${{ steps.aab_meta.outputs.aab_filename }}
142+
path: ${{ steps.aab_meta.outputs.new_path }}
143+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
build:
1010
name: Build Android App
1111
uses: ./.github/workflows/client.yml
12+
with:
13+
build_aab: true
1214
secrets: inherit
1315

1416
release:

0 commit comments

Comments
 (0)