Skip to content

Commit 09a5a77

Browse files
committed
fixup! CI: Cache packages
1 parent 6599c99 commit 09a5a77

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/build.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ jobs:
3939
- name: Checkout code
4040
uses: actions/checkout@v2
4141

42-
- name: Setup package cache
43-
uses: actions/cache@v4
42+
- name: Load package cache
43+
uses: actions/cache/restore@v4
4444
with:
4545
path: pkg-cache
46-
key: ${{ matrix.os }}-pkg-cache
46+
key: ${{ matrix.os }}-pkg-cache-${{ github.event_name == 'pull_request' && github.head_ref || 'main' }}-${{ github.sha }}
47+
restore-keys: |
48+
${{ matrix.os }}-pkg-cache-${{ github.event_name == 'pull_request' && github.head_ref || 'main' }}-
49+
${{ matrix.os }}-pkg-cache-main-
4750
4851
- name: Initialise Docker image
4952
run: |
@@ -124,3 +127,10 @@ jobs:
124127
-v "${{ github.workspace }}:/workspace":ro \
125128
"${{ matrix.os }}" \
126129
/bin/sh -c "${CMD}"
130+
131+
- name: Save package cache
132+
if: always()
133+
uses: actions/cache/save@v4
134+
with:
135+
path: pkg-cache
136+
key: ${{ matrix.os }}-pkg-cache-${{ github.event_name == 'pull_request' && github.head_ref || 'main' }}-${{ github.sha }}

0 commit comments

Comments
 (0)