Skip to content

Commit 91fbea0

Browse files
committed
Idk man is this how caching works?
1 parent 20fa7ad commit 91fbea0

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/new-workflow.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,68 @@ on:
99
- master
1010

1111
jobs:
12+
setup-repo:
13+
name: Setup Repository Tooling
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out source code
18+
uses: actions/checkout@v4
19+
20+
- name: Enable Corepack
21+
run: corepack enable
22+
23+
- name: Use Node.js 💻
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: .node-version
27+
cache: yarn
28+
29+
- name: Check cache for repotools
30+
uses: actions/cache@v4/restore
31+
id: cache-repotools
32+
with:
33+
path: ./lib/repotools/dist
34+
restore-keys: repotools
35+
36+
- name: Install Repotools Dependencies
37+
run: yarn workspaces focus @sourceacademy/modules-repotools
38+
39+
- name: Build Repotools
40+
if: steps.cache-repotools.outputs.cache-hit != 'true'
41+
run: yarn workspaces foreach -A --include @sourceacademy/modules-repotools run build
42+
43+
- name: Cache Repotools
44+
if: steps.cache-repotools.outputs.cache-hit != 'true'
45+
uses: actions/cache@v4/save
46+
with:
47+
path: ./lib/repotools/dist
48+
key: repotools
49+
50+
- name: Install Buildtools Dependencies
51+
run: yarn workspaces focus @sourceacademy/modules-buildtools
52+
53+
- name: Check cache for buildtools
54+
uses: actions/cache@v4/restore
55+
id: cache-buildtools
56+
with:
57+
path: ./lib/buildtools/bin/index.js
58+
restore-keys: buildtools
59+
60+
- name: Build Buildtools
61+
if: steps.cache-buildtools.outputs.cache-hit != 'true'
62+
run: yarn workspaces foreach -A --include @sourceacademy/modules-buildtools run build
63+
64+
- name: Cache Buildtools
65+
if: steps.cache-repotools.outputs.cache-hit != 'true'
66+
uses: actions/cache@v4/save
67+
with:
68+
path: ./lib/buildtools/bin/index.js
69+
key: buildtools
70+
1271
find-packages:
1372
name: Determine the packages present in the repo for the given type
73+
needs: setup-repo
1474
runs-on: ubuntu-latest
1575
strategy:
1676
matrix:
@@ -109,6 +169,12 @@ jobs:
109169
- name: Change into directory for ${{ matrix.package.name }}
110170
run: cd ${{ matrix.package.directory }}
111171

172+
- name: Restore buildtools
173+
uses: actions/cache@v4/restore
174+
with:
175+
key: buildtools
176+
path: ./lib/buildtools/bin/index.js
177+
112178
- name: Install dependencies
113179
uses: ./.github/actions/src/install-deps
114180
with:

0 commit comments

Comments
 (0)