buster/.github/actions/setup-node-env/action.yml

74 lines
2.0 KiB
YAML

name: 'Setup Node Environment'
description: 'Setup Node.js, pnpm, Bun, and install dependencies with caching'
inputs:
node-version:
description: 'Node.js version to use'
required: false
default: '22'
pnpm-version:
description: 'pnpm version to use'
required: false
default: '10.17.1'
bun-version:
description: 'Bun version to use'
required: false
default: 'latest'
install-filter:
description: 'Optional pnpm filter for selective dependency installation'
required: false
default: ''
cache-key:
description: 'Optional cache key for the cache action'
required: false
default: 'default'
runs:
using: 'composite'
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
- name: Setup Node.js
uses: useblacksmith/setup-node@v5
with:
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
node_modules
apps/*/node_modules
packages/*/node_modules
key: pnpm-workspace-v2-${{ inputs.cache-key }}-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
pnpm-workspace-v2-${{ inputs.cache-key }}-${{ github.ref_name }}-
pnpm-workspace-v2-${{ inputs.cache-key }}-
- name: Cache Turbo
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
turbo-${{ github.job }}-
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ inputs.bun-version }}
- name: Setup Supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest
- name: Install dependencies
run: pnpm install --frozen-lockfile${{ inputs.install-filter && format(' --filter={0}', inputs.install-filter) || '' }}
shell: bash