mirror of
https://github.com/actions/cache.git
synced 2024-11-27 05:49:02 +00:00
Merge pull request #804 from actions/Phantsure-patch-1
Update README to call out for version of cache
This commit is contained in:
commit
455d267066
52
README.md
52
README.md
@ -177,6 +177,58 @@ steps:
|
|||||||
|
|
||||||
> Note: The `id` defined in `actions/cache` must match the `id` in the `if` statement (i.e. `steps.[ID].outputs.cache-hit`)
|
> Note: The `id` defined in `actions/cache` must match the `id` in the `if` statement (i.e. `steps.[ID].outputs.cache-hit`)
|
||||||
|
|
||||||
|
|
||||||
|
## Cache Version
|
||||||
|
Cache version is unique for a combination of compression tool used for compression of cache (Gzip, Zstd, etc based on runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique cache entries. This also means that a cache created on `windows-latest` runner can't be restored on `ubuntu-latest` as cache `Version`s are different.
|
||||||
|
|
||||||
|
Example: Below example will create 3 unique caches with same keys. Ubuntu and windows runners will use different compression technique and hence create two different caches. And `build-linux` will create two different caches as the `paths` are different.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache Primes
|
||||||
|
id: cache-primes
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: prime-numbers
|
||||||
|
key: primes
|
||||||
|
|
||||||
|
- name: Generate Prime Numbers
|
||||||
|
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||||
|
run: ./generate-primes.sh -d prime-numbers
|
||||||
|
|
||||||
|
- name: Cache Numbers
|
||||||
|
id: cache-numbers
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: numbers
|
||||||
|
key: primes
|
||||||
|
|
||||||
|
- name: Generate Numbers
|
||||||
|
if: steps.cache-numbers.outputs.cache-hit != 'true'
|
||||||
|
run: ./generate-primes.sh -d numbers
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache Primes
|
||||||
|
id: cache-primes
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: prime-numbers
|
||||||
|
key: primes
|
||||||
|
|
||||||
|
- name: Generate Prime Numbers
|
||||||
|
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||||
|
run: ./generate-primes -d prime-numbers
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user