-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (88 loc) · 3.42 KB
/
release-android.yml
File metadata and controls
99 lines (88 loc) · 3.42 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
# When a GitHub Release is published (e.g. by club-calendar-version.yml), build Android on EAS and upload the APK.
#
# Prerequisites (one-time):
# 1. expo.dev → Access tokens → create token → repo secret EXPO_TOKEN
# 2. Locally: npx eas-cli login && npx eas-cli build -p android --profile github-apk
# (completes EAS project link, credentials, and writes extra.eas.projectId into app config)
# 3. Commit eas.json and any app.json / app.config.js changes EAS produced.
#
# Private git submodules: if checkout fails, add actions/checkout `token` using a PAT with
# repo access, or switch submodule URLs to HTTPS.
name: Release Android to GitHub
on:
release:
types: [published]
permissions:
contents: write
jobs:
eas-android-apk:
if: ${{ !github.event.release.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
submodules: recursive
- 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 EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: EAS Build (Android APK, wait for completion)
id: eas
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: |
set -euo pipefail
BUILD_JSON=$(eas build \
--platform android \
--profile github-apk \
--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
echo "url=$URL" >> "$GITHUB_OUTPUT"
- name: Download APK
env:
URL: ${{ steps.eas.outputs.url }}
run: |
set -euo pipefail
TAG="${{ github.event.release.tag_name }}"
OUT="BSR-SolarCar2-${TAG}.apk"
curl -fL --retry 3 -o "$OUT" "$URL"
ls -la "$OUT"
- name: Upload APK to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.event.release.tag_name }}"
gh release upload "$TAG" "BSR-SolarCar2-${TAG}.apk" --clobber