Files
2026-01-08 01:04:26 +00:00

42 lines
1.1 KiB
YAML

name: Setup Node.js and dependencies
description: Setup Node.js environment with npm dependencies
inputs:
node-version:
description: Node.js version
required: true
restore-nextjs-cache:
description: Whether to restore Next.js build cache
required: false
default: 'false'
runs:
using: composite
steps:
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: npm
- name: Restore or cache node_modules
id: cache-node-modules
uses: actions/cache@v5
with:
path: node_modules
key: node-modules-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: npm ci
- name: Restore Next.js build output
if: inputs.restore-nextjs-cache == 'true'
uses: actions/cache/restore@v5
with:
path: |
.next
key: nextjs-build-${{ inputs.node-version }}-${{ github.sha }}
fail-on-cache-miss: true