-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (116 loc) · 5.17 KB
/
eas-build.yml
File metadata and controls
127 lines (116 loc) · 5.17 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: EAS Build
# When run with platform=android, also uploads the APK to a GitHub Release (tag vX.Y.Z from package.json).
# Use profile "github-apk" to match release-android.yml and store builds.
on:
workflow_dispatch:
inputs:
platform:
description: 'Platform to build'
required: true
default: 'all'
type: choice
options:
- all
- android
- ios
profile:
description: 'Build profile'
required: true
default: 'preview'
type: choice
options:
- preview
- production
- github-apk
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🏗 Checkout repository
uses: actions/checkout@v4
- name: 🏗 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Use npm 10 for npm ci
run: npm install -g npm@10.9.2
- name: 📦 Install dependencies
run: npm ci
- name: 🏗 Setup Expo and EAS
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 🩺 Run Expo Doctor
run: |
npm run doctor 2>&1 | tee doctor_output.txt || true
if grep -q "No issues detected" doctor_output.txt; then
echo "✅ All expo-doctor checks passed"
exit 0
elif grep -q 'The package "expo-modules-core" should not be installed directly' doctor_output.txt && ! grep -q "Missing peer dependency: expo-modules-core" doctor_output.txt; then
echo "⚠️ Known: expo-modules-core is required by @clerk/expo (peer); expo-doctor dislikes direct install"
echo "✅ Treating as success"
exit 0
else
echo "❌ Some expo-doctor checks failed"
cat doctor_output.txt
exit 1
fi
- name: 🚀 EAS build (Android + attach APK to GitHub Release)
if: github.event.inputs.platform == 'android'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }}
EXPO_PUBLIC_AUTH_VERIFY_URL: ${{ secrets.EXPO_PUBLIC_AUTH_VERIFY_URL }}
EXPO_PUBLIC_INFLUX_URL: ${{ secrets.EXPO_PUBLIC_INFLUX_URL }}
EXPO_PUBLIC_INFLUX_TOKEN: ${{ secrets.EXPO_PUBLIC_INFLUX_TOKEN }}
EXPO_PUBLIC_INFLUX_ORG: ${{ secrets.EXPO_PUBLIC_INFLUX_ORG }}
EXPO_PUBLIC_INFLUX_BUCKET: ${{ secrets.EXPO_PUBLIC_INFLUX_BUCKET }}
EXPO_PUBLIC_INFLUX_WEB_PROXY: ${{ secrets.EXPO_PUBLIC_INFLUX_WEB_PROXY }}
EXPO_PUBLIC_BASE_PATH: ${{ secrets.EXPO_PUBLIC_BASE_PATH }}
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
METEOBLUE_API_KEY: ${{ secrets.METEOBLUE_API_KEY }}
run: |
set -euo pipefail
BUILD_JSON=$(eas build --platform android --profile "${{ github.event.inputs.profile }}" --non-interactive --wait --json)
echo "$BUILD_JSON" | tee eas-build.json
URL=$(echo "$BUILD_JSON" | jq -r 'if type == "array" then .[] else . end | .artifacts.applicationArchiveUrl // empty' | head -1)
if [ -z "$URL" ] || [ "$URL" = "null" ]; then
echo "Could not read applicationArchiveUrl from EAS output"
cat eas-build.json
exit 1
fi
VERSION=$(node -p "require('./package.json').version")
TAG="v${VERSION}"
OUT="BSR-SolarCar2-${TAG}.apk"
curl -fL --retry 3 -o "$OUT" "$URL"
ls -la "$OUT"
if gh release view "$TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
gh release upload "$TAG" "$OUT" --clobber --repo "${{ github.repository }}"
echo "Uploaded APK to existing release $TAG"
else
gh release create "$TAG" "$OUT" \
--repo "${{ github.repository }}" \
--title "BSR Solar Car 2 ${TAG}" \
--notes "APK from manual EAS Build (profile: ${{ github.event.inputs.profile }})."
echo "Created release $TAG with APK"
fi
- name: 🚀 EAS build (iOS or all)
if: github.event.inputs.platform != 'android'
env:
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY }}
EXPO_PUBLIC_AUTH_VERIFY_URL: ${{ secrets.EXPO_PUBLIC_AUTH_VERIFY_URL }}
EXPO_PUBLIC_INFLUX_URL: ${{ secrets.EXPO_PUBLIC_INFLUX_URL }}
EXPO_PUBLIC_INFLUX_TOKEN: ${{ secrets.EXPO_PUBLIC_INFLUX_TOKEN }}
EXPO_PUBLIC_INFLUX_ORG: ${{ secrets.EXPO_PUBLIC_INFLUX_ORG }}
EXPO_PUBLIC_INFLUX_BUCKET: ${{ secrets.EXPO_PUBLIC_INFLUX_BUCKET }}
EXPO_PUBLIC_INFLUX_WEB_PROXY: ${{ secrets.EXPO_PUBLIC_INFLUX_WEB_PROXY }}
EXPO_PUBLIC_BASE_PATH: ${{ secrets.EXPO_PUBLIC_BASE_PATH }}
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
METEOBLUE_API_KEY: ${{ secrets.METEOBLUE_API_KEY }}
run: |
eas build --platform ${{ github.event.inputs.platform }} --profile ${{ github.event.inputs.profile }} --non-interactive