name: 'Set up steps'
description: 'Steps to set up node, yarn and install dependencies'

runs:
  using: 'composite'
  steps:
    - name: Get yarn cache directory path
      id: yarn-cache-dir-path
      run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
      shell: bash

    - uses: actions/cache@v3
      id: yarn-cache
      with:
        path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
        key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
        restore-keys:
          ${{ runner.os }}-yarn-

    - name: Use Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '16.x'

    - name: Install dependencies
      run: yarn install --frozen-lockfile
      shell: bash
