name: Demo

on:
  push:
    branches:
      - dev

env:
  NODE_VERSION: 14
  NODE_OPTIONS: --max_old_space_size=6144

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Check out files from GitHub
        uses: actions/checkout@v2
      - name: Set up Node ${{ env.NODE_VERSION }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: yarn
      - name: Install dependencies
        run: yarn install
        env:
          CI: true
      - name: Build Demo
        run: ./node_modules/.bin/gulp build-demo
      - name: Deploy to Netlify
        uses: netlify/actions/cli@master
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
        with:
          args: deploy --dir=demo/dist --prod
