Deploy React Sample Apps #2326
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy React Sample Apps | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/deploy-react-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-react-sample-apps.yml' | |
- 'sample-apps/react/**' | |
- 'packages/**' | |
- '!packages/react-native-sdk/**' | |
- '!**/docusaurus/**' | |
workflow_dispatch: | |
concurrency: | |
group: deploy-react-sample-apps-${{ github.ref }} | |
cancel-in-progress: true | |
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_R6DLpP2Gxc0aRHGEopQWE8tveNDX | |
- name: livestream-app-react | |
project-id: prj_uNJTw7DefSAntAoWCXwJaHc1khoA | |
- name: audio-rooms | |
project-id: prj_0WnHcvVkXpM4PRc2ymVmrAHFILoT | |
- name: react-dogfood - https://pronto.getstream.io | |
project-id: prj_4TTdjeVHEDhWWiFRfjIr1QFb5ell | |
- name: react-dogfood-staging - https://pronto-staging.getstream.io | |
project-id: prj_xmKoy4ExySCQ4fpWoWSVXlcuvtfS | |
- name: react-dogfood - https://getstream.io/video/demos | |
project-id: prj_tTLn3XMVal4D1Nnel9nPJ0hoI9wA | |
base-path: /video/demos | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ matrix.application.project-id }} | |
VITE_STREAM_USER_TOKEN: ${{ secrets.EGRESS_USER_TOKEN }} | |
VITE_STREAM_API_KEY: ${{ vars.STREAM_API_KEY_SAMPLE_APPS }} | |
VITE_STREAM_SECRET: ${{ secrets.STREAM_SECRET_SAMPLE_APPS }} | |
VITE_EGRESS_SENTRY_DNS: ${{ secrets.EGRESS_SENTRY_DNS }} | |
VITE_TOKEN_PROVIDER_URL: ${{secrets.TOKEN_PROVIDER_URL}} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN_PRONTO }} | |
PRONTO_SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN_PRONTO }} | |
EGRESS_SENTRY_AUTH_TOKEN: ${{ secrets.EGRESS_SENTRY_AUTH_TOKEN }} | |
MODE: ${{ github.ref_name == 'main' && 'production' || 'preview' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.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 | |
env: | |
NODE_ENV: production | |
run: yarn build:react:deps | |
### Vercel deployment (Preview) ### | |
- name: Vercel Pull/Build/Deploy (Preview) | |
if: ${{ github.ref_name != 'main' }} | |
env: | |
NEXT_PUBLIC_BASE_PATH: ${{ matrix.application.base-path || '' }} | |
run: > | |
yarn vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} && | |
yarn vercel build --token=${{ secrets.VERCEL_TOKEN }} && | |
yarn vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | |
### Vercel deployment (Production) ### | |
- name: Vercel Pull/Build/Deploy (Production) | |
if: ${{ github.ref_name == 'main' }} | |
env: | |
NEXT_PUBLIC_BASE_PATH: ${{ matrix.application.base-path || '' }} | |
run: > | |
yarn vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} && | |
yarn vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} && | |
yarn vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |