@@ -40,22 +40,43 @@ jobs:
40
40
- uses : actions/checkout@v4
41
41
with :
42
42
ref : ${{ matrix.branch }}
43
+ - name : Build cache key
44
+ id : cache-key
45
+ run : |
46
+ HASH=$(git rev-parse --short HEAD)
47
+ echo "CACHE_KEY=${{ matrix.branch }}-$HASH" >> "$GITHUB_ENV"
48
+ - name : Restore cached artifacts
49
+ id : artifacts-restore
50
+ uses : actions/cache/restore@v4
51
+ with :
52
+ path : ${{ matrix.branch }}
53
+ key : CACHE_KEY
43
54
- uses : actions/setup-node@v4
55
+ if : steps.artifacts-restore.outputs.cache-hit != 'true'
44
56
with :
45
57
node-version : 23
46
58
cache : npm
47
- - run : npm ci
48
- - run : git checkout ${{ matrix.branch }}
49
- - run : npm run build-compat
50
- - run : npm run bundle
59
+ - name : Build
60
+ if : steps.artifacts-restore.outputs.cache-hit != 'true'
61
+ run : |
62
+ npm ci
63
+ npm run build-compat
64
+ npm run bundle
51
65
- name : Prepare build artifacts
66
+ if : steps.artifacts-restore.outputs.cache-hit != 'true'
52
67
run : |
53
68
mkdir -p ${{ matrix.branch }}/compat
54
69
cp tests/compat/index.html tests/compat/compat-data.js tests/compat/tests.js tests/compat/browsers-runner.js ${{ matrix.branch }}/compat
55
70
mkdir -p ${{ matrix.branch }}/bundles
56
71
cp tests/bundles/* ${{ matrix.branch }}/bundles
57
72
mkdir -p ${{ matrix.branch }}/unit-browser
58
73
cp tests/unit-browser/* ${{ matrix.branch }}/unit-browser
74
+ - name : Save cached artifacts
75
+ if : steps.artifacts-restore.outputs.cache-hit != 'true'
76
+ uses : actions/cache/save@v4
77
+ with :
78
+ path : ${{ matrix.branch }}
79
+ key : CACHE_KEY
59
80
- name : Upload artifacts for branch ${{ matrix.branch }}
60
81
uses : actions/upload-artifact@v4
61
82
with :
74
95
uses : actions/download-artifact@v4
75
96
with :
76
97
path : pages
77
- - run : cp -r docs/ pages/
98
+ - name : Add docs
99
+ run : cp -r docs/ pages/
78
100
- name : Setup Pages
79
101
uses : actions/configure-pages@v5
80
102
- name : Upload GitHub Pages artifact
0 commit comments