Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
40 lines (37 loc) · 1.52 KB
/
Copy pathaction.yml
File metadata and controls
40 lines (37 loc) · 1.52 KB
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
name: cache
description: Mount a build cache directory using Blacksmith sticky disks, or the GitHub Actions cache when running on GitHub-hosted runners.
inputs:
provider:
description: Empty or 'blacksmith' selects sticky disks; anything else selects actions/cache.
required: false
default: ''
key:
description: Cache key, shared by both backends.
required: true
path:
description: Path to mount.
required: true
save-suffix:
description: Appended to the actions/cache save key, for a job that must replace an entry another job of the same run already saved under that key. Sticky disks ignore it.
required: false
default: ''
# Predicates must stay the exact complement of the caller's runs-on — stickydisk
# only runs on Blacksmith.
runs:
using: composite
steps:
- name: Mount sticky disk
if: inputs.provider == '' || inputs.provider == 'blacksmith'
uses: useblacksmith/stickydisk@3f6be1451e3cad893b778bc93495c80452a5da26 # v1
with:
key: ${{ inputs.key }}
path: ${{ inputs.path }}
# run_id suffix + prefix restore-key: actions/cache skips save on an exact hit,
# which would freeze the cache at the first run's contents.
- name: Restore and save cache
if: inputs.provider != '' && inputs.provider != 'blacksmith'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
key: ${{ inputs.key }}-${{ github.run_id }}${{ inputs.save-suffix }}
restore-keys: ${{ inputs.key }}-
path: ${{ inputs.path }}