Skip to content

Commit 97158cb

Browse files
committed
add chaching for assets workflow
1 parent d23edc2 commit 97158cb

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/assets.yaml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Assets
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches:
6+
- main
7+
- improve-github-workflows-caching # Delete this after checking the caching works
68

79
jobs:
810
build:
@@ -11,13 +13,39 @@ jobs:
1113

1214
steps:
1315
- uses: actions/checkout@v4
16+
1417
- name: Set up Elixir
1518
uses: erlef/setup-beam@v1.18.0
1619
with:
1720
elixir-version: "1.17.3"
1821
otp-version: "27.1.2"
19-
- name: Setup project
20-
run: mix setup
22+
23+
- name: Cache Mix
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
deps
28+
_build
29+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
30+
restore-keys: ${{ runner.os }}-mix-
31+
32+
- name: Cache npm dependencies
33+
uses: actions/cache@v2
34+
with:
35+
path: ./assets/node_modules
36+
key: ${{ runner.os }}-npm-${{ hashFiles('assets/package-lock.json') }}
37+
restore-keys: ${{ runner.os }}-npm-
38+
39+
- name: Install npm dependencies
40+
working-directory: ./assets
41+
run: npm install
42+
43+
- name: Setup assets
44+
run: mix "assets.setup"
45+
46+
- name: Build assets
47+
run: mix "assets.build"
48+
2149
- name: Push updated assets
2250
id: push_assets
2351
uses: stefanzweifel/git-auto-commit-action@v5

0 commit comments

Comments
 (0)