name: Build frontend

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest
    environment: test

    strategy:
      matrix:
        node-version: [17.x]

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
          cache-dependency-path: '**/package-lock.json'
      - run: npm ci
        working-directory: ./src/main/js/pluckr-app
      - run: npm run build --if-present
        working-directory: ./src/main/js/pluckr-app
