Skip to content

Commit ce50ef9

Browse files
committed
ci: Try caching dependencies with actions/cache
1 parent 8ab7942 commit ce50ef9

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

.github/workflows/check.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,23 @@ jobs:
4747
uses: actions/setup-node@v5
4848
with:
4949
node-version: "20"
50+
package-manager-cache: false
51+
52+
- name: Get yarn cache directory path
53+
id: yarn-cache-dir-path
54+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
55+
56+
- name: Cache yarn
57+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
58+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
59+
with:
60+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
61+
key: ${{ runner.os }}-yarn-check-${{ hashFiles('**/yarn.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-yarn-check-
5064
5165
- name: Install dependencies
52-
run: yarn install --frozen-lockfile
66+
run: yarn install --frozen-lockfile --prefer-offline
5367

5468
- name: Typecheck
5569
run: yarn typecheck

.github/workflows/deploy.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,34 @@ jobs:
2121
# https://github.com/facebook/docusaurus/pull/9954#issuecomment-2032900942
2222
fetch-depth: 0
2323
persist-credentials: false
24-
- uses: actions/setup-node@v5
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v5
2526
with:
26-
node-version: 20
27-
cache: yarn
27+
node-version: "20"
28+
package-manager-cache: false
29+
2830
- name: Setup Pages
2931
uses: actions/configure-pages@v5
32+
33+
- name: Get yarn cache directory path
34+
id: yarn-cache-dir-path
35+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
36+
37+
- name: Cache yarn
38+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
39+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
40+
with:
41+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
42+
key: ${{ runner.os }}-yarn-deploy-${{ hashFiles('**/yarn.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-yarn-deploy-
45+
3046
- name: Install dependencies
31-
run: yarn install --frozen-lockfile
47+
run: yarn install --frozen-lockfile --prefer-offline
48+
3249
- name: Build website
3350
run: yarn build
51+
3452
- name: Upload artifact
3553
uses: actions/upload-pages-artifact@v4
3654
with:

0 commit comments

Comments
 (0)