name: pl-hooks CI

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

jobs:
  build:
    runs-on: ubuntu-latest
    name: Test for a successful build
    strategy:
      matrix:
        node-version: [22.x]

    steps:
    - name: Install system dependencies
      run: sudo apt install -y unzip

    - name: Checkout code
      uses: actions/checkout@v3

    - name: Setup pnpm
      uses: pnpm/action-setup@v4
      with:
        version: 10

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'pnpm'

    - name: Install deps
      working-directory: .
      run: pnpm install

    - name: Build pl-api
      env:
        NODE_ENV: production
      working-directory: ./packages/pl-api
      run: pnpm build

    - name: Lint
      working-directory: ./packages/pl-hooks
      run: pnpm lint

    - name: build
      env:
        NODE_ENV: production
      working-directory: ./packages/pl-hooks
      run: pnpm build
