-
Notifications
You must be signed in to change notification settings - Fork 24
105 lines (95 loc) · 3.82 KB
/
deploy-react-sample-apps.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
99
100
101
102
103
104
105
name: Deploy React Sample Apps
on:
push:
branches:
- main
paths:
- '.github/workflows/deploy-sample-apps.yml'
- 'sample-apps/react/**'
- '!packages/**' # avoid duplicated deployment if react-sdk also changed
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- '.github/workflows/deploy-sample-apps.yml'
- 'sample-apps/react/**'
- 'packages/**'
- '!packages/react-native-sdk/**'
- '!packages/react-sdk/docusaurus/**'
workflow_dispatch:
jobs:
build-and-deploy-sample-apps:
name: Deploy ${{ matrix.application.name }}
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
application:
- name: messenger-clone-react
project-id: prj_FNUiw2FtWJEDVHP5XttyLQmGw39n
populate-tokens: true
- name: zoom-clone-react
project-id: prj_y2GjsUXNvW7MdQ0EpJVG0FBNNovL
populate-tokens: true
- name: egress-composite
project-id: prj_y9JDolEfVxWC50c4h71UxIL7XNXz
- name: react-video-demo
project-id: prj_8vo9hxdzh9FnRjO950qpt1fwUuPl
- name: livestream-app-react
project-id: prj_uNJTw7DefSAntAoWCXwJaHc1khoA
- name: audio-rooms
project-id: prj_0WnHcvVkXpM4PRc2ymVmrAHFILoT
- name: react-dogfood
project-id: prj_4TTdjeVHEDhWWiFRfjIr1QFb5ell
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ matrix.application.project-id }}
VITE_STREAM_API_KEY: ${{ vars.EGRESS_STREAM_API_KEY }}
VITE_STREAM_TOKEN: ${{ secrets.EGRESS_USER_TOKEN }}
VITE_STREAM_KEY: ${{ vars.STREAM_API_KEY_SAMPLE_APPS }}
VITE_STREAM_SECRET: ${{ secrets.STREAM_SECRET_SAMPLE_APPS }}
VITE_VIDEO_USER_ID: ${{vars.VIDEO_DEMO_USER_ID}}
VITE_VIDEO_USER_NAME: ${{vars.VIDEO_DEMO_USER_NAME}}
VITE_VIDEO_USER_TOKEN: ${{secrets.VIDEO_DEMO_USER_TOKEN}}
VITE_MAPBOX_GL_TOKEN: ${{secrets.VIDEO_DEMO_MAPBOX_GL_TOKEN}}
VITE_VIDEO_DEMO_SENTRY_DNS: ${{secrets.VIDEO_DEMO_SENTRY_DNS}}
VITE_TOKEN_PROVIDER_URL: ${{secrets.TOKEN_PROVIDER_URL}}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Install Dependencies
run: yarn install --immutable
- name: Populate tokens
if: ${{ matrix.application.populate-tokens }}
run: yarn workspace @stream-io/${{ matrix.application.name }} scripts:populate-tokens
- name: Build packages
run: NODE_ENV=production yarn build:react:deps
### Vercel deployment (Preview) ###
- name: Vercel Pull Configuration (Preview)
if: ${{ github.ref_name != 'main' }}
run: yarn vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Vercel Build (Preview)
if: ${{ github.ref_name != 'main' }}
run: yarn vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Vercel Deploy (Preview)
if: ${{ github.ref_name != 'main' }}
run: yarn vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
### Vercel deployment (Production) ###
- name: Vercel Pull Configuration (Production)
if: ${{ github.ref_name == 'main' }}
run: yarn vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Vercel Build (Production)
if: ${{ github.ref_name == 'main' }}
run: yarn vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Vercel Deploy (Production)
if: ${{ github.ref_name == 'main' }}
run: yarn vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}