Skip to content

Commit 98e6ef3

Browse files
committed
ci: attempt to cache npm dependencies
1 parent 75dcf40 commit 98e6ef3

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .github/actions/cached-deps/action.yml
2+
name: 'Get & Cache Dependencies'
3+
description: 'Get & Cache Dependencies(via npm) for faster builds'
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: 'Cache Dependencies'
8+
uses: 'actions/cache@v3'
9+
id: cache-node-modules
10+
with:
11+
path: 'node_modules'
12+
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
13+
14+
- name: Install Dependencies
15+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
16+
run: |
17+
npm i
18+
npm run clean
19+
npm i --workspaces
20+
shell: bash

.github/workflows/nodejs.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414

1515
jobs:
1616
send_docker_image_to_hub:
17+
needs: [build]
1718
runs-on: ubuntu-latest
1819
steps:
1920
- uses: actions/checkout@v4
@@ -51,12 +52,8 @@ jobs:
5152
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
5253
echo ">>> Started xvfb"
5354
54-
- name: npm install
55-
run: |
56-
npm i
57-
npm run clean
58-
npm i --workspaces
59-
npm run build
55+
- name: Load & Cache Dependencies
56+
uses: ./.github/actions/cached-deps
6057

6158
- name: npm build
6259
run: |

0 commit comments

Comments
 (0)