Skip to content

Deploy React Sample Apps #251

Deploy React Sample Apps

Deploy React Sample Apps #251

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: 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_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 }}