Skip to content

Commit a6af70f

Browse files
Updated workflow to fix issue getting apk_url.
1 parent 8a87695 commit a6af70f

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,17 @@ jobs:
108108
echo "🔄 Initializing build process..."
109109
sudo apt-get install -y jq
110110
BUILD_JSON=$(npx eas build -p android --profile production --non-interactive --json)
111+
echo "Raw build output: $BUILD_JSON"
111112
BUILD_ID=$(echo "$BUILD_JSON" | jq -r '.[0].id')
113+
if [[ -z "$BUILD_ID" || "$BUILD_ID" == "null" ]]; then
114+
echo "Error: Failed to retrieve BUILD_ID!"
115+
exit 1
116+
fi
117+
echo "EAS Build started with ID: $BUILD_ID"
112118
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
113119
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_OUTPUT
120+
env:
121+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
114122

115123
download-apk:
116124
name: "📥 APK Artifact Handler"
@@ -139,6 +147,7 @@ jobs:
139147
- name: "🧰 Install Build Tools"
140148
run: |
141149
npm install -g eas-cli@latest
150+
sudo apt-get update
142151
sudo apt-get install -y jq curl dotenv
143152
144153
# ========================
@@ -191,10 +200,10 @@ jobs:
191200
;;
192201
193202
"ERRORED"|"CANCELLED")
194-
echo "❌ Build failed! Error details:"
195-
echo "$BUILD_STATUS_JSON" | jq .
196-
exit 1
197-
;;
203+
echo "❌ Build failed! Error details:"
204+
echo "$BUILD_STATUS_JSON" | jq .
205+
exit 1
206+
;;
198207
199208
"NEW"|"IN_QUE"|"IN_PROGRESS"|"PENDING")
200209
echo "⏳ Build is still in progress..."
@@ -222,7 +231,12 @@ jobs:
222231
id: download
223232
run: |
224233
echo "🔽 Retrieving APK URL..."
225-
APK_URL=$(npx eas build:list --build-id ${{ needs.build-android.outputs.build_id }} --json | jq -r '.[0].artifacts.url')
234+
# Use the build:view command to get a clean JSON response
235+
APK_URL=$(npx eas build:view --json ${{ needs.build-android.outputs.build_id }} | jq -r '.artifacts.buildUrl')
236+
if [[ -z "$APK_URL" || "$APK_URL" == "null" ]]; then
237+
echo "❌ Error: No APK URL found!"
238+
exit 1
239+
fi
226240
echo "📥 Downloading APK from $APK_URL..."
227241
curl -L "$APK_URL" -o app-release.apk
228242
echo "APK_PATH=app-release.apk" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)