Skip to content

Commit ae6f6a5

Browse files
committed
chore: Try storing cache in the same workflow
1 parent 468767f commit ae6f6a5

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

.github/actions/install/action.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
name: Install and cache
22
description: Setup the runner environment, by installing dependencies and restoring caches
33

4-
outputs:
5-
cache-key:
6-
description: The key to the Nx cache
7-
value: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
8-
94
runs:
105
using: composite
116
steps:
@@ -25,9 +20,3 @@ runs:
2520
- name: Install Node.js dependencies
2621
shell: bash
2722
run: pnpm install
28-
- name: Restore Nx cache
29-
id: cache-nx-restore
30-
uses: actions/cache/restore@v4
31-
with:
32-
path: .nx
33-
key: nx-cache-${{ github.ref }}

.github/workflows/build.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@ jobs:
1717
uses: actions/checkout@v4
1818
- uses: ./.github/actions/install
1919
id: install
20+
- name: Restore Nx cache
21+
id: cache-nx-restore
22+
uses: actions/cache/restore@v4
23+
with:
24+
path: .nx
25+
key: nx-cache-ref-${{ github.ref }}
2026
- name: Lint
2127
run: pnpm nx run-many --target=lint --all
22-
- uses: ./.github/actions/update-cache
28+
- name: Update cache
29+
id: cache-update
30+
uses: actions/cache/save@v4
2331
with:
24-
cache-key: ${{ steps.install.outputs.cache-key }}
32+
path: .nx
33+
key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
2534

2635
check-spell:
2736
name: Check spelling
@@ -32,11 +41,20 @@ jobs:
3241
uses: actions/checkout@v4
3342
- uses: ./.github/actions/install
3443
id: install
44+
- name: Restore Nx cache
45+
id: cache-nx-restore
46+
uses: actions/cache/restore@v4
47+
with:
48+
path: .nx
49+
key: nx-cache-ref-${{ github.ref }}
3550
- name: Check spelling
3651
run: pnpm nx run-many --target=check:spell --all
37-
- uses: ./.github/actions/update-cache
52+
- name: Update cache
53+
id: cache-update
54+
uses: actions/cache/save@v4
3855
with:
39-
cache-key: ${{ steps.install.outputs.cache-key }}
56+
path: .nx
57+
key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
4058

4159
check-types:
4260
name: Check types
@@ -47,8 +65,17 @@ jobs:
4765
uses: actions/checkout@v4
4866
- uses: ./.github/actions/install
4967
id: install
68+
- name: Restore Nx cache
69+
id: cache-nx-restore
70+
uses: actions/cache/restore@v4
71+
with:
72+
path: .nx
73+
key: nx-cache-ref-${{ github.ref }}
5074
- name: Check types
5175
run: pnpm nx run-many --target=check:types --all
52-
- uses: ./.github/actions/update-cache
76+
- name: Update cache
77+
id: cache-update
78+
uses: actions/cache/save@v4
5379
with:
54-
cache-key: ${{ steps.install.outputs.cache-key }}
80+
path: .nx
81+
key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)