Skip to content

Commit e4e5e2a

Browse files
committed
ci: debug APK location — copy all build outputs to dist/, upload dir
1 parent 9c2f3d1 commit e4e5e2a

1 file changed

Lines changed: 44 additions & 24 deletions

File tree

.github/workflows/build-android.yml

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,55 +60,79 @@ jobs:
6060
[ -n "$GRADLEW" ] || { echo "::error::No gradlew found after prebuild"; exit 1; }
6161
chmod +x "$GRADLEW"
6262
ANDROID_DIR=$(dirname "$GRADLEW")
63-
echo "gradlew=$GRADLEW" >> $GITHUB_OUTPUT
6463
echo "android_dir=$ANDROID_DIR" >> $GITHUB_OUTPUT
65-
echo "Found android dir: $ANDROID_DIR"
64+
echo "gradlew_abs=$(realpath $GRADLEW)" >> $GITHUB_OUTPUT
65+
echo "Found gradlew at: $(realpath $GRADLEW)"
66+
echo "Android dir: $ANDROID_DIR"
6667
6768
- name: Cache Gradle
6869
uses: actions/cache@v4
6970
with:
7071
path: |
7172
~/.gradle/wrapper
7273
~/.gradle/caches
73-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}-v4
74+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}-v5
7475
restore-keys: ${{ runner.os }}-gradle-
7576

7677
- name: Build debug APK
7778
working-directory: ${{ steps.find-android.outputs.android_dir }}
7879
run: |
80+
echo "=== PWD: $(pwd) ==="
81+
echo "=== gradlew: $(realpath ./gradlew) ==="
7982
./gradlew assembleDebug \
8083
--no-daemon \
8184
--no-build-cache \
8285
--stacktrace \
8386
2>&1 | tee /tmp/gradle.log
84-
tail -30 /tmp/gradle.log
87+
GRADLE_RC=${PIPESTATUS[0]}
88+
tail -40 /tmp/gradle.log
89+
exit $GRADLE_RC
8590
86-
# Find ALL .apk files produced anywhere in the workspace and show them
87-
- name: Inventory APK files
91+
# Collect everything Gradle produced and copy to a flat dist/ folder
92+
- name: Collect build outputs
8893
if: always()
8994
run: |
90-
echo "=== All .apk files in workspace ==="
95+
echo "=== All files under android_dir build outputs ==="
96+
ADIR="${{ steps.find-android.outputs.android_dir }}"
97+
find "$ADIR" -path "*/build/outputs*" -not -path "*/node_modules/*" 2>/dev/null \
98+
| head -60 | tee /tmp/build-outputs.txt
99+
100+
echo ""
101+
echo "=== APK files specifically ==="
91102
find . -name "*.apk" -not -path "*/node_modules/*" 2>/dev/null \
92-
| xargs -I{} sh -c 'echo "{}: $(du -h {} | cut -f1)"' || echo "(none found)"
103+
| tee /tmp/apk-list.txt
104+
105+
echo ""
106+
echo "=== Copying APKs to dist/ ==="
107+
mkdir -p dist
108+
while IFS= read -r apk; do
109+
dest="dist/$(basename $apk)"
110+
cp "$apk" "$dest"
111+
echo "Copied: $apk -> $dest ($(du -h $dest | cut -f1))"
112+
done < /tmp/apk-list.txt
113+
114+
echo ""
115+
echo "=== dist/ contents ==="
116+
ls -lh dist/ 2>/dev/null || echo "(empty)"
93117
94118
- name: Upload Gradle log
95119
if: always()
96120
uses: actions/upload-artifact@v4
97121
with:
98122
name: gradle-log-run${{ github.run_number }}
99-
path: /tmp/gradle.log
123+
path: |
124+
/tmp/gradle.log
125+
/tmp/apk-list.txt
126+
/tmp/build-outputs.txt
100127
if-no-files-found: ignore
101128
retention-days: 7
102129

103-
# Use a glob pattern across the entire workspace to catch the APK
104-
# regardless of what path expo prebuild generated it under
105-
- name: Upload all APKs (glob)
130+
# Upload the entire dist/ directory (will contain the APK if build succeeded)
131+
- name: Upload APK
106132
uses: actions/upload-artifact@v4
107133
with:
108-
name: openchat-android-debug-${{ github.run_number }}
109-
path: |
110-
**/outputs/apk/**/*.apk
111-
**/build/outputs/**/*.apk
134+
name: openchat-android-debug-run${{ github.run_number }}
135+
path: dist/
112136
if-no-files-found: error
113137
retention-days: 30
114138

@@ -117,12 +141,8 @@ jobs:
117141
run: |
118142
echo "### ✅ Android Debug APK" >> $GITHUB_STEP_SUMMARY
119143
echo "" >> $GITHUB_STEP_SUMMARY
120-
echo "**Artifact:** \`openchat-android-debug-${{ github.run_number }}\`" >> $GITHUB_STEP_SUMMARY
121-
echo "" >> $GITHUB_STEP_SUMMARY
122-
echo "**Download:** Actions run page → Artifacts section → click to download zip." >> $GITHUB_STEP_SUMMARY
144+
echo "Artifact: \`openchat-android-debug-run${{ github.run_number }}\`" >> $GITHUB_STEP_SUMMARY
123145
echo "" >> $GITHUB_STEP_SUMMARY
124-
echo "**Install on Pixel 9:**" >> $GITHUB_STEP_SUMMARY
125-
echo "1. Transfer APK to device (USB or share link)" >> $GITHUB_STEP_SUMMARY
126-
echo "2. Open Files app, tap the APK" >> $GITHUB_STEP_SUMMARY
127-
echo "3. Allow 'Install unknown apps' when prompted" >> $GITHUB_STEP_SUMMARY
128-
echo "4. Launch OpenChat, set Convex URL in settings" >> $GITHUB_STEP_SUMMARY
146+
echo "Download from the Artifacts section of this run page." >> $GITHUB_STEP_SUMMARY
147+
echo "Unzip and transfer the APK to your Pixel 9." >> $GITHUB_STEP_SUMMARY
148+
echo "Enable Install unknown apps → tap the APK to install." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)