-
Notifications
You must be signed in to change notification settings - Fork 9
98 lines (90 loc) · 3.42 KB
/
mobile.yml
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
name: Mobile Deployment
on: [deployment_status, workflow_dispatch]
jobs:
# TODO move this to a common file
Setup:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# Can't use cache because of https://github.com/actions/cache/issues/319
# cache: 'pipenv'
- name: Install bootstrapper dependencies
run: pipenv install --dev --deploy
- run: |
config_file=$(./scripts/vue_or_react.sh)
pipenv run cookiecutter . --config-file $config_file --no-input -f
cat $config_file
- uses: actions/upload-artifact@v4
with:
name: my_project
path: my_project/
retention-days: 1
configuremobile:
needs: Setup
runs-on: ubuntu-latest
outputs:
BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
name: check diff
- id: checkdiff
run: |
git fetch origin main
if [ {{ "${{ github.event_name }}" }} == "workflow_dispatch" ]; then
echo "This workflow was triggered by a workflow_dispatch event."
echo "BUILD_MOBILE_APP=1" >> $GITHUB_OUTPUT
else
echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)
echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT
fi
publish:
needs: configuremobile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: my_project
path: my_project/
- name: Create config files
run: |
ls
cp resources/app-config-js-values.txt my_project/resources/app-config-js-values.txt
cp resources/eas-json-values.txt my_project/resources/eas-json-values.txt
cd my_project
. scripts/setup_mobile_config.sh app.config.js resources/app-config-js-values.txt
. scripts/setup_mobile_config.sh eas.json resources/eas-json-values.txt
cat mobile/eas.json
cat mobile/app.config.js
- uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: 🏗 Setup Expo and EAS
uses: expo/expo-github-action@v8
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 📦 Install dependencies
working-directory: ./my_project/mobile
run: yarn install
- name: 🚀 Publish preview
working-directory: ./my_project/mobile
run: |
eas update --branch="${{ github.event.deployment_status.environment_url }}" --non-interactive --auto
echo "${{ env.BACKEND_SERVER_URL }} and ${{ github.event.deployment_status.environment_url }}"
env:
EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}"
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7"