Skip to content

Commit 08420a3

Browse files
committed
add caching between jops
1 parent f78a73a commit 08420a3

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [master]
66
pull_request:
7-
types: [opened, synchronize, reopened, closed]
7+
types: [ opened, synchronize, reopened, closed ]
88

99
permissions:
1010
contents: write
@@ -23,25 +23,42 @@ jobs:
2323
with:
2424
node-version: 22
2525

26+
- name: Cache npm dependencies
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.npm
30+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-
33+
2634
- name: Install dependencies
27-
run: npm ci
35+
run: npm ci --prefer-offline
2836

2937
- name: Check Formatting (Prettier)
3038
run: npm run format:check
3139

3240
lint-check:
3341
runs-on: ubuntu-latest
42+
3443
steps:
3544
- uses: actions/checkout@v4
3645

3746
- uses: actions/setup-node@v4
3847
with:
3948
node-version: 22
4049

50+
- name: Cache npm dependencies
51+
uses: actions/cache@v4
52+
with:
53+
path: ~/.npm
54+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
55+
restore-keys: |
56+
${{ runner.os }}-node-
57+
4158
- name: Install dependencies
42-
run: npm ci
59+
run: npm ci --prefer-offline
4360

44-
- name: Lint Code
61+
- name: Lint Code (ESLint)
4562
run: npm run lint
4663

4764

@@ -50,7 +67,7 @@ jobs:
5067
# Runs ONLY if lint + prettier succeed
5168
# ---------------------
5269
build:
53-
needs: [format-check, lint-check] # Dependencies
70+
needs: [ format-check, lint-check ]
5471
if: github.event.action != 'closed'
5572
runs-on: ubuntu-latest
5673

@@ -65,8 +82,16 @@ jobs:
6582
with:
6683
node-version: 22
6784

85+
- name: Cache npm dependencies
86+
uses: actions/cache@v4
87+
with:
88+
path: ~/.npm
89+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
90+
restore-keys: |
91+
${{ runner.os }}-node-
92+
6893
- name: Install dependencies
69-
run: npm ci
94+
run: npm ci --prefer-offline
7095

7196
- name: Inject correct baseUrl into docusaurus.config.js
7297
id: inject
@@ -76,6 +101,7 @@ jobs:
76101
else
77102
BASE_URL="/${{ github.event.repository.name }}/"
78103
fi
104+
79105
echo "Using baseUrl=$BASE_URL"
80106
echo "baseUrl=$BASE_URL" >> $GITHUB_OUTPUT
81107

0 commit comments

Comments
 (0)