-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (36 loc) · 969 Bytes
/
cache.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Example use of cache action
name: using-cache
on:
workflow_dispatch:
jobs:
create:
runs-on: ubuntu-latest
steps:
- name: Create file
run: echo "Timestamp $(date '+%s')" | tee timestamp.txt
# Here cache the files. Key is unique for the run number. Run number same for all jobs in the run
- name: Cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./timestamp.txt
key: file-${{ github.run_number }}
use:
runs-on: ubuntu-latest
needs: create
steps:
- name: List File Before Cache
run: ls -l
# Both key and path must match to restore the files
- name: Cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./timestamp.txt
key: file-${{ github.run_number }}
- name: List File After Cache
run: ls -l
- name: View File
run: cat timestamp.txt