name: Build and Deploy

on:
  push:
    branches:
      - 'GitHub-StoryBook'
      - 'VUD-StoryBook'

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    timeout-minutes: 4

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          persist-credentials: false

      - name: Setup node/npm
        uses: actions/setup-node@v3
        with:
          node-version: "18"
          cache: "npm"

      - name: Install and Build
        run: |
          npm install
          npm run build-storybook

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: storybook-pages
          folder: storybook-static
