Compare commits
1 Commits
0.2.1
...
feat-add-n
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb9434e1e3 |
20
.gitea/workflows/run_node.yaml
Normal file
20
.gitea/workflows/run_node.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: Run NodeJS script with package cache
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
script:
|
||||||
|
description: Path to the Node.js script to run
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-node:
|
||||||
|
name: Run NodeJS script
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: ./.gitea/workflows/setup_node.yaml
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
- run: npm run ${{ inputs.script }}
|
||||||
33
.gitea/workflows/setup_node.yaml
Normal file
33
.gitea/workflows/setup_node.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Setup NodeJS with package cache
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
node-version-file:
|
||||||
|
description: Path to the Node.js version file
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: .nvmrc
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup-node:
|
||||||
|
name: Setup NodeJS
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
id: cache-modules
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.npm
|
||||||
|
node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: ${{ inputs.node-version-file }}
|
||||||
|
cache: "npm"
|
||||||
|
- if: steps.cache-modules.outputs.cache-hit != 'true'
|
||||||
|
run: npm ci
|
||||||
Reference in New Issue
Block a user