From d13855834fce45e28d2dedbaa40f5cadd39684f7 Mon Sep 17 00:00:00 2001 From: Javid Ahmed Date: Sat, 7 Mar 2026 00:50:33 +0000 Subject: [PATCH] Add setup-node action and update documentation in WORKFLOWS.md --- .github/actions/setup/setup-node/action.yml | 17 +++++++++++++++++ docs/WORKFLOWS.md | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup/setup-node/action.yml diff --git a/.github/actions/setup/setup-node/action.yml b/.github/actions/setup/setup-node/action.yml new file mode 100644 index 0000000..1c9fe6b --- /dev/null +++ b/.github/actions/setup/setup-node/action.yml @@ -0,0 +1,17 @@ +name: Setup Node.js +description: Set up Node.js with npm cache and install dependencies. + +runs: + using: composite + steps: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + cache-dependency-path: ${{ github.event.repository.name }}-frontend/package-lock.json + - name: Install dependencies + run: | + npm ci + working-directory: ${{ github.event.repository.name }}-frontend + shell: bash diff --git a/docs/WORKFLOWS.md b/docs/WORKFLOWS.md index dbf0782..27bc754 100644 --- a/docs/WORKFLOWS.md +++ b/docs/WORKFLOWS.md @@ -11,15 +11,31 @@ This document focuses on the Docker-specific workflow and reusable actions uniqu ## Table of Contents - [Reusable Actions (`./github/actions`)](#reusable-actions-githubactions) + - [Setup Actions (`/setup/**/action.yml`)](#setup-actions-setupactionyml) - [Docker Actions (`docker/**/action.yml`)](#docker-actions-dockeractionyml) - [Workflows (`./github/workflows`)](#workflows-githubworkflows) - [Docker Workflow (`docker.yml`)](#docker-workflow-dockeryml) - ## Reusable Actions (`./github/actions`) The following actions can be referenced from other repositories using `javidahmed64592/python-template-server/.github/actions/{category}/{action}@main`. +### Setup Actions (`/setup/**/action.yml`) + +**setup-node:** +- Description: Set up Node.js with npm cache and install dependencies. +- Location: `setup-node/action.yml` +- Steps: + - Installs Node using `actions/setup-node@v4` with caching enabled + - Install npm packages +- Note: Requires a frontend directory named `-frontend` + +Usage: +```yaml +steps: + - uses: javidahmed64592/python-template-server/.github/actions/setup/setup-node@main +``` + ### Docker Actions (`docker/**/action.yml`) The following actions encapsulate the steps in the Docker workflow and can be referenced locally with `uses: ./.github/actions/docker/`.