File tree Expand file tree Collapse file tree 2 files changed +37
-15
lines changed
Expand file tree Collapse file tree 2 files changed +37
-15
lines changed Original file line number Diff line number Diff line change 1+ name : NPM Install
2+ run-name : " Runner (${{ inputs.runner }}) / Node (${{ inputs.node-version }})"
3+
4+ on :
5+ workflow_call :
6+ inputs :
7+ runner :
8+ required : true
9+ type : string
10+ node-version :
11+ required : true
12+ type : string
13+
14+ jobs :
15+ npm-install :
16+ name : " NPM Install (${{ inputs.runner }}) / Node (${{ inputs.node-version }})"
17+ runs-on : ${{ inputs.runner }}
18+ steps :
19+ - name : Install NodeJS ${{ inputs.node-version }}
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : ${{ inputs.node-version }}
23+ - name : Get npm cache directory
24+ id : npm-cache-dir
25+ shell : bash
26+ run : echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
27+ - uses : actions/cache@v4
28+ id : npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
29+ with :
30+ path : ${{ steps.npm-cache-dir.outputs.dir }}
31+ key : ${{ inputs.runner }}-node-{{ inputs.node-version }}-${{ hashFiles('**/package-lock.json') }}
32+ restore-keys : |
33+ ${{ inputs.runner }}-node-{{ inputs.node-version }}-
34+ - name : Install dependencies
35+ run : npm ci --omit=optional
Original file line number Diff line number Diff line change @@ -29,23 +29,10 @@ jobs:
2929 steps :
3030 - name : Code checkout
3131 uses : actions/checkout@v4
32- - name : Install NodeJS ${{ matrix.node-version }}
33- uses : actions/setup-node@v4
32+ - uses : ./.github/workflows/npm-ci.yml
3433 with :
34+ runner : ${{ matrix.runner }}
3535 node-version : ${{ matrix.node-version }}
36- - name : Install dependencies
37- run : npm ci --omit=optional
38- - name : Get npm cache directory
39- id : npm-cache-dir
40- shell : bash
41- run : echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
42- - uses : actions/cache@v4
43- id : npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
44- with :
45- path : ${{ steps.npm-cache-dir.outputs.dir }}
46- key : ${{ runner.os }}-node-{{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
47- restore-keys : |
48- ${{ runner.os }}-node-{{ matrix.node-version }}-
4936 - name : Build workspaces
5037 run : npm run build -ws
5138 - name : Remove dev dependencies
You can’t perform that action at this time.
0 commit comments