-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 2.6 KB
/
build-android.yml
File metadata and controls
87 lines (76 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Expo EAS Android Build
on:
push:
branches:
- main
- dev
- backlog/*
jobs:
build-android:
runs-on: ubuntu-latest
steps:
# 1. Checkout code
- name: Checkout repo
uses: actions/checkout@v3
# 2. Setup Node.js with cache
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
# 3. Cache npm & Gradle
- name: Cache npm & Gradle
uses: actions/cache@v3
with:
path: |
~/.npm/_npx
~/.gradle/caches
key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-deps-
# 4. Install dependencies
- name: Install dependencies
run: npm ci
# 5. Setup Expo & EAS CLI
- name: Setup Expo
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
# 6. Run EAS Build (waits for completion)
- name: Run EAS build
id: eas-build
run: |
echo "Starting EAS build..."
BUILD_INFO=$(eas build --platform android --profile preview --non-interactive --wait --json)
echo "$BUILD_INFO" > build.json
BUILD_URL=$(jq -r '.[0].artifacts.buildUrl' build.json)
echo "Build completed: $BUILD_URL"
echo "build_url=$BUILD_URL" >> $GITHUB_OUTPUT
# 7. Download built APK
- name: Download APK from Expo
run: |
echo "Downloading APK from Expo..."
curl -L "${{ steps.eas-build.outputs.build_url }}" -o app-preview.apk
ls -lh app-preview.apk
# 8. Upload APK as GitHub Artifact
- name: Upload APK Artifact
uses: actions/upload-artifact@v4
with:
name: app-preview-${{ github.ref_name }}-b${{ github.run_number }}
path: app-preview.apk
# 9. Send Discord Notification
- name: Discord Notification
if: always()
uses: Ilshidur/action-discord@master
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: |
*Expo Android Build - Beta*
Status: **${{ job.status }}**
━━━━━━━━━━━━━━━━━━
**Artifact:** [app-preview-${{ github.ref_name }}-b${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
━━━━━━━━━━━━━━━━━━
Commit: `${{ github.sha }}`
Branch: `${{ github.ref_name }}`