Skip to content

Commit 9c2f75e

Browse files
committed
Updated again for failing android with pnpm.
1 parent c120040 commit 9c2f75e

File tree

1 file changed

+73
-94
lines changed

1 file changed

+73
-94
lines changed

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

Lines changed: 73 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: 🚀 EAS Android Build & Smart Release
1+
name: 🚠EAS Android Build & Smart Release
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
workflow_dispatch:
78

89
env:
@@ -11,7 +12,7 @@ env:
1112

1213
jobs:
1314
build-android:
14-
name: 🔨 Build Android - Version Manager
15+
name: 🔠Build Android - Version Manager
1516
runs-on: ubuntu-latest
1617
outputs:
1718
build_id: ${{ steps.build.outputs.BUILD_ID }}
@@ -20,55 +21,46 @@ jobs:
2021
build_date: ${{ steps.version-control.outputs.build_date }}
2122
is_production: ${{ steps.version-control.outputs.is_production }}
2223
steps:
23-
# ========================
24-
# 🛠️ Repository Setup
25-
# ========================
26-
- name: "📦 Checkout (Full History)"
24+
# Repository Setup
25+
- name: "📠Checkout (Full History)"
2726
uses: actions/checkout@v4
2827
with:
2928
fetch-depth: 0
3029

31-
# ========================
32-
# ⚙️ Environment Configuration
33-
# ========================
34-
- name: "📦 Setup Node.js 20.x"
30+
# Environment Configuration
31+
- name: "📠Setup Node.js 20.x"
3532
uses: actions/setup-node@v4
3633
with:
3734
node-version: 20.x
38-
# NOTE: Removed cache: "pnpm" to avoid expecting pnpm pre-installed
3935

40-
- name: "🔧 Install pnpm"
36+
- name: "🔠Install pnpm"
4137
run: |
4238
npm install -g pnpm
4339
pnpm --version
4440
45-
- name: "🧩 Install dependencies (ci)"
41+
- name: "🧠Install dependencies (ci)"
4642
run: pnpm install --frozen-lockfile
4743

48-
# ========================
49-
# 🔄 Version Management
50-
# ========================
51-
- name: "🔄 Update Production Version"
44+
# Version Management
45+
- name: "🔠Update Production Version"
5246
if: github.ref == 'refs/heads/main'
5347
run: node scripts/bumpVersion.js
5448

55-
- name: "🔧 Configure Git for Automation"
49+
- name: "🔠Configure Git for Automation"
5650
if: github.ref == 'refs/heads/main'
5751
run: |
5852
git config --global user.name "GitHub Actions"
5953
git config --global user.email "[email protected]"
6054
61-
- name: "💾 Commit Version Update"
55+
- name: "💠Commit Version Update"
6256
if: github.ref == 'refs/heads/main'
6357
run: |
6458
git add version.json
6559
git commit -m "chore: Auto-increment version [skip ci]"
6660
git push
6761
68-
# ========================
69-
# 📌 Version Tagging
70-
# ========================
71-
- name: "🏷️ Set CI/CD Versions"
62+
# Version Tagging
63+
- name: "ðŸï¸ Set CI/CD Versions"
7264
id: version-control
7365
run: |
7466
# Use version from version.json (requires jq)
@@ -95,10 +87,8 @@ jobs:
9587
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
9688
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
9789
98-
# ========================
99-
# 🔐 EAS Setup & Auth
100-
# ========================
101-
- name: "🔧 Setup pnpm global bin"
90+
# EAS Setup & Auth
91+
- name: "🔠Setup pnpm global bin"
10292
env:
10393
SHELL: /bin/bash
10494
run: |
@@ -110,14 +100,12 @@ jobs:
110100
- name: "⚙️ Install EAS CLI"
111101
run: pnpm add -g eas-cli@latest
112102

113-
- name: "🔐 Verify Expo Credentials"
103+
- name: "🔠Verify Expo Credentials"
114104
run: eas whoami --token $EXPO_TOKEN
115105
env:
116106
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
117107

118-
# ========================
119-
# Ensure consistent pnpm store: Force reinstallation of dependencies
120-
# ========================
108+
# Force reinstallation of dependencies
121109
- name: "Set pnpm global store directory"
122110
run: pnpm config set store-dir "$HOME/.local/share/pnpm/store" --global
123111

@@ -127,19 +115,23 @@ jobs:
127115
- name: "Install @expo/config-plugins"
128116
run: pnpm add @expo/config-plugins
129117

130-
# ========================
131118
# Install @babel/runtime to resolve bundling error
132-
# ========================
133119
- name: "Install @babel/runtime"
134120
run: pnpm add @babel/runtime
135121

136-
# ========================
137-
# 🏗️ Build Execution
138-
# ========================
139-
- name: "🚀 Trigger EAS Build"
122+
# Debug Dependency Tree
123+
- name: "🔠Debug Dependency Tree"
124+
run: |
125+
echo "Listing installed dependencies..."
126+
pnpm list --depth=0
127+
echo "Checking for expo-constants..."
128+
ls node_modules/expo-constants || echo "expo-constants not found!"
129+
130+
# Build Execution
131+
- name: "🚠Trigger EAS Build"
140132
id: build
141133
run: |
142-
echo "🔄 Initializing build process..."
134+
echo "🔠Initializing build process..."
143135
sudo apt-get install -y jq
144136
BUILD_JSON=$(eas build -p android --profile production --non-interactive --json)
145137
echo "Raw build output: $BUILD_JSON"
@@ -155,50 +147,43 @@ jobs:
155147
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
156148

157149
download-apk:
158-
name: "📥 APK Artifact Handler"
150+
name: "📠APK Artifact Handler"
159151
runs-on: ubuntu-latest
160152
needs: build-android
161153
outputs:
162154
apk_path: ${{ steps.download.outputs.APK_PATH }}
163155
steps:
164-
# ========================
165-
# 🛠️ Environment Setup
166-
# ========================
167-
- name: "📦 Checkout Repository"
156+
# Environment Setup
157+
- name: "📠Checkout Repository"
168158
uses: actions/checkout@v4
169159

170160
- name: "⚙️ Setup Node.js"
171161
uses: actions/setup-node@v4
172162
with:
173163
node-version: 20.x
174-
# NOTE: Removed cache setting here as well
175164

176-
- name: "🔧 Install pnpm"
165+
- name: "🔠Install pnpm"
177166
run: |
178167
npm install -g pnpm
179168
pnpm --version
180169
181-
- name: "📦 Install Dependencies"
170+
- name: "📠Install Dependencies"
182171
run: pnpm install --frozen-lockfile
183172

184-
# ========================
185-
# 📦 Dependency Management
186-
# ========================
187-
- name: "🧰 Install Build Tools"
173+
# Dependency Management
174+
- name: "🧠Install Build Tools"
188175
run: |
189176
pnpm add -g eas-cli@latest
190177
sudo apt-get update
191178
sudo apt-get install -y jq curl dotenv
192179
193-
# ========================
194-
# 🔍 Build Monitoring
195-
# ========================
180+
# Build Monitoring
196181
- name: "⏳ Wait for Build Completion"
197182
run: |
198183
echo "⏰ Monitoring build status..."
199184
cd $GITHUB_WORKSPACE
200185
BUILD_ID=${{ needs.build-android.outputs.build_id }}
201-
echo "🔍 Starting build monitoring for BUILD_ID: $BUILD_ID"
186+
echo "🔠Starting build monitoring for BUILD_ID: $BUILD_ID"
202187
203188
# Initial check without JSON for better error visibility
204189
eas build:view $BUILD_ID || true
@@ -209,10 +194,10 @@ jobs:
209194
210195
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
211196
echo -e "\n=== Attempt $((RETRY_COUNT+1))/$MAX_RETRIES ==="
212-
197+
213198
# Fetch build status in JSON format
214199
BUILD_STATUS_JSON=$(eas build:view --json $BUILD_ID)
215-
echo "📄 Raw API response: $BUILD_STATUS_JSON"
200+
echo "📠Raw API response: $BUILD_STATUS_JSON"
216201
217202
# Validate JSON and check for empty response
218203
if ! echo "$BUILD_STATUS_JSON" | jq empty >/dev/null 2>&1 || [[ -z "$BUILD_STATUS_JSON" ]]; then
@@ -225,7 +210,7 @@ jobs:
225210
BUILD_STATUS=$(echo "$BUILD_STATUS_JSON" | jq -r '.status')
226211
ERROR_MESSAGE=$(echo "$BUILD_STATUS_JSON" | jq -r '.error.message // empty')
227212
228-
echo "🔍 Parsed status: $BUILD_STATUS"
213+
echo "🔠Parsed status: $BUILD_STATUS"
229214
[[ -n "$ERROR_MESSAGE" ]] && echo "❌ Error message: $ERROR_MESSAGE"
230215
231216
case $BUILD_STATUS in
@@ -243,7 +228,7 @@ jobs:
243228
echo "$BUILD_STATUS_JSON" | jq .
244229
exit 1
245230
;;
246-
"NEW"|"IN_QUE"|"IN_PROGRESS"|"PENDING")
231+
"NEW"|"IN_QUEUE"|"IN_PROGRESS"|"PENDING")
247232
echo "⏳ Build is still in progress..."
248233
;;
249234
*)
@@ -261,101 +246,95 @@ jobs:
261246
env:
262247
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
263248

264-
# ========================
265-
# 📦 Artifact Handling
266-
# ========================
267-
- name: "📥 Download APK"
249+
# Artifact Handling
250+
- name: "📠Download APK"
268251
id: download
269252
run: |
270-
echo "🔽 Retrieving APK URL..."
253+
echo "🔠Retrieving APK URL..."
271254
APK_URL=$(eas build:view --json ${{ needs.build-android.outputs.build_id }} | jq -r '.artifacts.buildUrl')
272255
if [[ -z "$APK_URL" || "$APK_URL" == "null" ]]; then
273256
echo "❌ Error: No APK URL found!"
274257
exit 1
275258
fi
276-
echo "📥 Downloading APK from $APK_URL..."
259+
echo "📠Downloading APK from $APK_URL..."
277260
curl -L "$APK_URL" -o app-release.apk
278261
echo "APK_PATH=app-release.apk" >> $GITHUB_OUTPUT
279262
280-
- name: "📤 Upload Artifact"
263+
- name: "📠Upload Artifact"
281264
uses: actions/upload-artifact@v4
282265
with:
283266
name: android-apk
284267
path: app-release.apk
285268

286269
generate-changelog:
287-
name: "📜 Changelog Generator"
270+
name: "📠Changelog Generator"
288271
runs-on: ubuntu-latest
289272
needs: build-android
290273
outputs:
291274
changelog: ${{ steps.changelog.outputs.CHANGELOG }}
292275
steps:
293-
# ========================
294-
# 🛠️ Repository Setup
295-
# ========================
296-
- name: "📂 Checkout with Full History"
276+
# Repository Setup
277+
- name: "📠Checkout with Full History"
297278
uses: actions/checkout@v4
298279
with:
299280
fetch-depth: 0
300281

301-
# ========================
302-
# 📄 Changelog Generation
303-
# ========================
304-
- name: "📋 Create Release Notes"
282+
# Changelog Generation
283+
- name: "📠Create Release Notes"
305284
id: changelog
306285
run: |
307-
echo "📝 Generating changelog from git history..."
286+
echo "📠Generating changelog from git history..."
308287
CHANGELOG=$(git log --pretty=format:"- %s (%h) by %an" -n 15)
309288
echo "$CHANGELOG" > changelog.txt
310289
311290
# FIXED OUTPUT HANDLING (ONLY CHANGE)
312291
delimiter=$(openssl rand -hex 6)
313-
echo "CHANGELOG<<${delimiter}" >> $GITHUB_OUTPUT
292+
echo "CHANGELOG<<$delimiter" >> $GITHUB_OUTPUT
314293
cat changelog.txt >> $GITHUB_OUTPUT
315-
echo "${delimiter}" >> $GITHUB_OUTPUT
294+
echo "$delimiter" >> $GITHUB_OUTPUT
316295
317-
- name: "📤 Upload Changelog"
296+
- name: "📠Upload Changelog"
318297
uses: actions/upload-artifact@v4
319298
with:
320299
name: changelog
321300
path: changelog.txt
322301

323302
create-release:
324-
name: "🚀 Smart Release Publisher"
303+
name: "🚠Smart Release Publisher"
325304
runs-on: ubuntu-latest
326-
needs: [build-android, download-apk, generate-changelog]
305+
needs:
306+
- build-android
307+
- download-apk
308+
- generate-changelog
327309
steps:
328-
# ========================
329-
# 📥 Artifact Retrieval
330-
# ========================
331-
- name: "📦 Get APK Artifact"
310+
# Artifact Retrieval
311+
- name: "📠Get APK Artifact"
332312
uses: actions/download-artifact@v4
333313
with:
334314
name: android-apk
335315

336-
- name: "📄 Get Changelog"
316+
- name: "📠Get Changelog"
337317
uses: actions/download-artifact@v4
338318
with:
339319
name: changelog
340320

341-
# ========================
342-
# 🏷️ Release Creation
343-
# ========================
344-
- name: "🎚️ Determine Release Type"
321+
# Release Creation
322+
- name: "ðŸŽï¸ Determine Release Type"
345323
id: release-type
346324
run: |
347-
echo "🔍 Detecting release type..."
325+
echo "🔠Detecting release type..."
348326
if [ "${{ needs.build-android.outputs.is_production }}" = "true" ]; then
349-
echo "🟢 Production release detected"
327+
echo "🟠Production release detected"
350328
RELEASE_TAG="v${{ needs.build-android.outputs.app_version }}"
351329
RELEASE_TITLE="Production Release v${{ needs.build-android.outputs.app_version }}"
352330
else
353-
echo "🟡 Nightly build detected"
331+
echo "🟠Nightly build detected"
354332
RELEASE_TAG="nightly-${{ needs.build-android.outputs.build_date }}"
355333
RELEASE_TITLE="Nightly Build (${{ needs.build-android.outputs.build_date }})"
356334
fi
357335
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_OUTPUT
358-
- name: "🎉 Publish GitHub Release"
336+
337+
- name: "🎠Publish GitHub Release"
359338
uses: softprops/action-gh-release@v2
360339
with:
361340
tag_name: ${{ steps.release-type.outputs.RELEASE_TAG }}

0 commit comments

Comments
 (0)