|
1 | | -name: Preview |
| 1 | +name: CI - APP Preview |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - 'releases/**' |
8 | 4 | pull_request: |
9 | | - branches: |
10 | | - - '*' |
| 5 | + branches: ['*'] |
| 6 | + push: |
| 7 | + branches: ['dev', 'staging', 'main', 'release/**'] |
11 | 8 |
|
12 | 9 | jobs: |
13 | 10 | update: |
14 | 11 | name: Publish Preview Channel |
15 | 12 | runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + node-version: [20.x] |
16 | 16 | steps: |
| 17 | + # Check for EXPO_TOKEN |
17 | 18 | - name: Check for EXPO_TOKEN |
18 | 19 | run: | |
19 | 20 | if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then |
20 | | - echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions" |
| 21 | + echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets." |
21 | 22 | exit 1 |
22 | 23 | fi |
23 | 24 |
|
| 25 | + # checkout the repository |
24 | 26 | - name: Checkout repository |
25 | 27 | uses: actions/checkout@v2 |
26 | 28 |
|
| 29 | + # setup node |
27 | 30 | - name: Setup Node |
28 | | - uses: actions/setup-node@v2 |
| 31 | + uses: actions/setup-node@v3 |
29 | 32 | with: |
30 | | - node-version: 20.x |
| 33 | + cache-dependency-path: package-lock.json |
| 34 | + node-version: ${{ matrix.node-version }} |
31 | 35 | cache: npm |
32 | 36 |
|
| 37 | + # setup expo |
33 | 38 | - name: Setup Expo |
34 | 39 | uses: expo/expo-github-action@v7 |
35 | 40 | with: |
36 | 41 | expo-version: latest |
37 | 42 | eas-version: latest |
38 | 43 | token: ${{ secrets.EXPO_TOKEN }} |
39 | 44 |
|
| 45 | + # install dependencies |
40 | 46 | - name: Install dependencies |
41 | 47 | run: npm ci |
42 | 48 |
|
| 49 | + # get branch name |
43 | 50 | - name: Get branch name |
44 | 51 | id: branch-name |
45 | 52 | uses: tj-actions/branch-names@v7 |
46 | 53 |
|
| 54 | + # eas update (PR) |
| 55 | + - name: EAS update |
| 56 | + if: github.event_name == 'pull_request' && steps.branch-name.outputs.current_branch != 'main' |
| 57 | + run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.pull_request.title }}" |
| 58 | + env: |
| 59 | + NODE_ENV: development |
| 60 | + |
47 | 61 | - name: EAS update |
48 | | - if: github.event_name == 'pull_request' |
| 62 | + if: github.event_name == 'pull_request' && steps.branch-name.outputs.current_branch == 'main' |
49 | 63 | run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.pull_request.title }}" |
| 64 | + env: |
| 65 | + NODE_ENV: production |
| 66 | + |
| 67 | + # eas update (PUSH) |
| 68 | + - name: EAS update |
| 69 | + if: github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main' |
| 70 | + run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.head_commit.message }}" |
| 71 | + env: |
| 72 | + NODE_ENV: development |
50 | 73 |
|
51 | 74 | - name: EAS update |
52 | | - if: github.event_name == 'push' |
| 75 | + if: github.event_name == 'push' && steps.branch-name.outputs.current_branch == 'main' |
53 | 76 | run: eas update --branch ${{ steps.branch-name.outputs.current_branch }} --message "${{ github.event.head_commit.message }}" |
| 77 | + env: |
| 78 | + NODE_ENV: production |
0 commit comments