feat: add Layout Switcher to the Video Demo app #2212
Workflow file for this run
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: Copy React Demo to S3 bucket | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/copy-react-demo-s3.yml' | |
- 'sample-apps/react/react-video-demo/**' | |
- '!packages/**' # avoid duplicated deployment if react-sdk also changed | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
paths: | |
- '.github/workflows/copy-react-demo-s3.yml' | |
- 'sample-apps/react/react-video-demo/**' | |
- 'packages/**' | |
- '!packages/react-native-sdk/**' | |
workflow_dispatch: | |
jobs: | |
build-and-copy: | |
runs-on: ubuntu-latest | |
env: | |
VITE_STREAM_API_KEY: ${{ vars.EGRESS_STREAM_API_KEY }} | |
VITE_STREAM_TOKEN: ${{ secrets.EGRESS_USER_TOKEN }} | |
VITE_STREAM_KEY: ${{ vars.VIDEO_DEMO_STREAM_API_KEY }} | |
VITE_STREAM_SECRET: ${{ secrets.VIDEO_DEMO_STREAM_SECRET }} | |
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}} | |
VITE_GTM_ID: ${{ secrets.VIDEO_DEMO_GTM_ID }} | |
VITE_GTM_PROJECT: ${{ vars.VIDEO_DEMO_GTM_PROJECT }} | |
VITE_GLEAP_KEY: ${{ secrets.VIDEO_DEMO_GLEAP_KEY }} | |
steps: | |
- name: Checkout | |
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: Build packages | |
run: NODE_ENV=production yarn build:react:deps | |
- name: Build React Demo staging | |
if: ${{ github.ref_name != 'main' }} | |
run: yarn build:react:video-demo --mode staging | |
- name: Build React Demo production | |
if: ${{ github.ref_name == 'main' }} | |
run: yarn build:react:video-demo --mode production | |
- name: Setup AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{vars.AWS_REGION}} | |
- name: Copy PR build artifacts to AWS S3 Bucket | |
if: ${{ github.ref_name != 'main' }} | |
run: | | |
aws s3 sync sample-apps/react/react-video-demo/dist s3://${{secrets.S3_BUCKET_NAME_STAGING}}/video/demos --delete | |
- name: Copy main build artifacts to AWS S3 Bucket | |
if: ${{ github.ref_name == 'main' }} | |
run: | | |
aws s3 sync sample-apps/react/react-video-demo/dist s3://${{secrets.S3_BUCKET_NAME_PRODUCTION}}/video/demos --delete | |
- name: Invalidate Cloudfront cache (staging) | |
if: ${{ github.ref_name != 'main' }} | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{secrets.AWS_DISTRIBUTION_ID_STAGING}} --paths "/video/demos/*" | |
- name: Invalidate Cloudfront cache (production) | |
if: ${{ github.ref_name == 'main' }} | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{secrets.AWS_DISTRIBUTION_ID_PRODUCTION}} --paths "/video/demos/*" |