name: Build

on:
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        node-version: [18.x, 20.x, 22.x]  # specify the Node.js versions you want to test against
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: yarn
          cache-dependency-path: yarn.lock

      - name: Install dependencies
        run: yarn install

      - name: Fix version
        if: github.base_ref == 'main'
        run: yarn fix-version

      - name: Build Project
        env:
          FORCE_COLOR: 3
        run: yarn build
