name: Build packages

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: Setup Node.js 12.x
        uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Install dependencies
        run: |
          npm ci
          npm ci --prefix src/packages/excalidraw
          npm ci --prefix src/packages/utils

      - name: Build @excalidraw/excalidraw
        run: |
          npm run pack --prefix src/packages/excalidraw

      - name: Build @excalidraw/utils
        run: |
          npm run pack --prefix src/packages/utils
