Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit fea82e4

Browse files
committed
feat(workflow): ! NOT READY ! - Publish expo preview with custom Expo server
1 parent f1bf21f commit fea82e4

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

.github/workflows/expo_preview.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: expo_preview.yml
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- synchronize
7+
8+
jobs:
9+
preview:
10+
name: Preview with ExpoGo
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v2
21+
with:
22+
node-version: 18.x
23+
cache: "npm"
24+
25+
- name: Install dependencies
26+
run: npm i
27+
28+
- name: Create dist folder
29+
run: |
30+
mkdir dist
31+
mkdir dist/expo
32+
33+
- name: Export AppEntry
34+
run: npx expo export --dev --platform ios --output-dir build_ios & npx expo export --dev --platform android --output-dir build_android
35+
36+
- name: Move iOS AppEntry
37+
run: |
38+
cd build_ios
39+
PATH_TO_ENTRY="$(find . | grep 'AppEntry.js')"
40+
mv $PATH_TO_ENTRY ./../dist/expo/AppEntry_ios.js
41+
cd ..
42+
43+
- name: Move Android AppEntry
44+
run: |
45+
cd build_android
46+
PATH_TO_ENTRY="$(find . | grep 'AppEntry.js')"
47+
mv $PATH_TO_ENTRY ./../dist/expo/AppEntry_android.js
48+
cd ..
49+
50+
- name: Move assets
51+
run: |
52+
mv build_ios/assets dist/assets
53+
54+
- name: Copy app.json
55+
run: cp app.json dist/app.json
56+
57+
- name: Cleanup
58+
run: rm -rf build_ios build_android
59+
60+
- name: Cloning the PR repository
61+
run: |
62+
git clone "https://github.com/-- !!! REPO USER / REPO NAME !!! --.git" pr_repo
63+
64+
- name: Transfering the build to PR repository
65+
run: |
66+
mkdir pr_repo/${{ github.event.pull_request.number }}
67+
cp -r dist/* pr_repo/${{ github.event.pull_request.number }}
68+
cd pr_repo
69+
git config --global user.email "-- !!! COMMIT MAIL !!! --"
70+
git config --global user.name "-- !!! COMMIT NAME !!! --"
71+
git add .
72+
git commit -m "Build PR#${{ github.event.pull_request.number }}"
73+
git push https://${{ secrets.GH_TOKEN }}@github.com/-- !!! REPO USER / REPO NAME !!! --.git
74+
cd ..
75+
76+
- name: Commenting on PR
77+
uses: actions/github-script@v4
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
script: |
81+
github.issues.createComment({
82+
issue_number: context.issue.number,
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
body: `
86+
<h1 align="center">🎉 La preview est prête 🎉</h1>
87+
88+
![iOS](https://raw.githubusercontent.com/PapillonApp/chat-themes/refs/heads/main/.github/assets/ios_light.png#gh-light-mode-only)
89+
![iOS](https://raw.githubusercontent.com/PapillonApp/chat-themes/refs/heads/main/.github/assets/ios_dark.png#gh-dark-mode-only)
90+
91+
<img
92+
src="http://api.qrserver.com/v1/create-qr-code/?data=exp://-- !!! EXPO SERVER !!! --/${{ github.event.pull_request.number }}?platform=ios&size=150x150&margin=5"
93+
align="left"
94+
/>
95+
Pour exécuter cette preview sur ton iPhone, tu auras besoin de l'application ExpoGo.
96+
Une fois installée, scanne ce QR code à l'aide de l'appareil photo ou entre cette url dans Expo :
97+
\`exp://-- !!! EXPO SERVER !!! --/${{ github.event.pull_request.number }}?platform=ios\`
98+
99+
<br><br><br>
100+
<hr>
101+
102+
![Android](https://raw.githubusercontent.com/PapillonApp/chat-themes/refs/heads/main/.github/assets/android_light.png#gh-light-mode-only)
103+
![Android](https://raw.githubusercontent.com/PapillonApp/chat-themes/refs/heads/main/.github/assets/android_dark.png#gh-dark-mode-only)
104+
105+
<img
106+
src="http://api.qrserver.com/v1/create-qr-code/?data=exp://-- !!! EXPO SERVER !!! --/${{ github.event.pull_request.number }}?platform=android&size=150x150&margin=5"
107+
align="left"
108+
/>
109+
Pour exécuter cette preview sur ton téléphone, tu auras besoin de l'application ExpoGo.
110+
Télécharge-la depuis le Google PlayStore, puis une fois installée, scanne ce QR code à l'aide du scanneur de QR code
111+
de ton mobile ou entre cette url dans Expo :
112+
\`exp://-- !!! EXPO SERVER !!! --/${{ github.event.pull_request.number }}?platform=android\`
113+
114+
<br>
115+
`
116+
});

0 commit comments

Comments
 (0)