# This is a basic workflow to help you get started with Actions

name: CI

on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [master]
  pull_request:
    branches: [master]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Install modules
        run: npm install
      - name: Run tests
        run: npm test

  build-and-deploy-storybook:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install modules
        run: npm install
      - name: Build Storybook
        run: npm run-script build-storybook
      - name: Deploy Storybook
        uses: JamesIves/github-pages-deploy-action@4.1.3
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: storybook-static # The folder the action should deploy.
