name: CI

on:
    push:
        branches:
            - '**'

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

jobs:
    build:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                job: [ lint, 'ci:test', 'storybook:build' ]
        steps:
            -   uses: actions/checkout@v2

            -   name: Read .nvmrc
                run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
                id: nvm

            -   name: Use Node.js ${{ steps.nvm.outputs.NVMRC }}
                uses: actions/setup-node@v2
                with:
                    node-version: "${{ steps.nvm.outputs.NVMRC }}"

            -   name: install
                run: npm ci

            -   name: build
                run: npm run build

            -   name: Run ${{ matrix.job }}
                run: npm run ${{ matrix.job }}
