Skip to content

Commit 2da3822

Browse files
Fixing workflow.
1 parent c79caa9 commit 2da3822

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

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

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,55 @@ jobs:
3232
- name: Start EAS Build
3333
id: build
3434
run: |
35-
BUILD_ID=$(npx eas build -p android --profile production --non-interactive --json | jq -r '.[0].id')
35+
BUILD_JSON=$(npx eas build -p android --profile production --non-interactive --json)
36+
echo "EAS build response: $BUILD_JSON"
37+
38+
BUILD_ID=$(echo "$BUILD_JSON" | jq -r '.[0].id' 2>/dev/null)
39+
if [[ -z "$BUILD_ID" || "$BUILD_ID" == "null" ]]; then
40+
echo "Error: Failed to retrieve BUILD_ID!"
41+
exit 1
42+
fi
43+
3644
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
3745
env:
3846
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
3947

4048
- name: Wait for EAS Build to Complete
4149
run: |
42-
while true; do
43-
STATUS=$(npx eas build:view --build-id $BUILD_ID --json | jq -r '.status')
44-
echo "Current Status: $STATUS"
45-
if [ "$STATUS" == "finished" ]; then
46-
DOWNLOAD_URL=$(npx eas build:view --build-id $BUILD_ID --json | jq -r '.artifacts.buildUrl')
47-
echo "APK_URL=$DOWNLOAD_URL" >> $GITHUB_ENV
50+
RETRY_COUNT=0
51+
MAX_RETRIES=20
52+
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
53+
BUILD_STATUS_JSON=$(npx eas build:view --build-id $BUILD_ID --json 2>/dev/null)
54+
echo "Build status response: $BUILD_STATUS_JSON"
55+
56+
BUILD_STATUS=$(echo "$BUILD_STATUS_JSON" | jq -r '.status' 2>/dev/null)
57+
if [[ -z "$BUILD_STATUS" || "$BUILD_STATUS" == "null" ]]; then
58+
echo "Error: Failed to fetch build status!"
59+
exit 1
60+
fi
61+
62+
echo "Current Status: $BUILD_STATUS"
63+
if [[ "$BUILD_STATUS" == "finished" ]]; then
64+
APK_URL=$(echo "$BUILD_STATUS_JSON" | jq -r '.artifacts.buildUrl' 2>/dev/null)
65+
echo "APK_URL=$APK_URL" >> $GITHUB_ENV
4866
break
49-
elif [ "$STATUS" == "errored" ]; then
67+
elif [[ "$BUILD_STATUS" == "errored" ]]; then
5068
echo "EAS build failed."
5169
exit 1
5270
fi
71+
72+
RETRY_COUNT=$((RETRY_COUNT+1))
5373
sleep 30
5474
done
5575
env:
5676
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
5777

78+
- name: Download APK
79+
run: |
80+
echo "Downloading APK from: $APK_URL"
81+
curl -L $APK_URL -o app-release.apk
82+
ls -lh app-release.apk
83+
5884
- name: Generate Changelog
5985
id: changelog
6086
run: |
@@ -75,4 +101,4 @@ jobs:
75101
body: ${{ env.CHANGELOG }}
76102
draft: false
77103
prerelease: false
78-
files: ${{ env.APK_URL }}
104+
files: app-release.apk

0 commit comments

Comments
 (0)