name: Node + PNPM
description: '…'

runs:
  using: composite
  steps:
    - name: Setup PNPM 8.6.7
      uses: pnpm/action-setup@v2
      with:
        version: 8.6.7
        run_install: false

    - name: Setup Node.js 20.x.x
      uses: actions/setup-node@v3
      with:
        node-version: 20
        cache: 'pnpm'

    # ——————————————————————————————————————————————————————————————————————————

    - name: Get PNPM store directory
      id: pnpm-cache
      shell: bash
      run: |
        echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

    - name: Setup PNPM cache
      uses: actions/cache@v3
      with:
        path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
        key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
        restore-keys: |
          ${{ runner.os }}-pnpm-store-

    # ——————————————————————————————————————————————————————————————————————————

    - name: Install Node dependencies
      shell: bash
      run: pnpm install
