# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json

name: Setup Project

on:
  workflow_call:

jobs:
  setup_project_job:
    name: "Setup Project"
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout Repository"
        id: checkout
        uses: actions/checkout@v3

      - name: "Determine Node Version from .nvmrc"
        id: node-version
        run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_ENV

      - name: "Setup Node"
        id: setup-node
        uses: actions/setup-node@v3
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: "Install Dependencies"
        id: install-deps
        run: "npm ci"

      - name: "Persist Project Between Jobs"
        id: persist-project
        uses: actions/cache@v3
        with:
          path: ./*
          key: project-${{ github.sha }}
