Skip to content

Commit b820478

Browse files
authored
Merge pull request #329 from actions/aiyan/v2-release-doc
Update readme and examples to use v2
2 parents 9ab9538 + e6c708b commit b820478

File tree

3 files changed

+90
-73
lines changed

3 files changed

+90
-73
lines changed

README.md

+30-6
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,36 @@ This action allows caching dependencies and build outputs to improve workflow ex
88

99
See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows).
1010

11+
## What's New
12+
13+
* Added support for multiple paths, [glob patterns](https://github.com/actions/toolkit/tree/master/packages/glob), and single file caches.
14+
15+
```yaml
16+
- name: Cache multiple paths
17+
uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/cache
21+
!~/cache/exclude
22+
**/node_modules
23+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
24+
```
25+
26+
* Increased performance and improved cache sizes using `zstd` compression for Linux and macOS runners
27+
* Allowed caching for all events with a ref. See [events that trigger workflow](https://help.github.com/en/actions/reference/events-that-trigger-workflows) for info on which events do not have a `GITHUB_REF`
28+
* Released the [`@actions/cache`](https://github.com/actions/toolkit/tree/master/packages/cache) npm package to allow other actions to utilize caching
29+
* Added a best-effort cleanup step to delete the archive after extraction to reduce storage space
30+
31+
Refer [here](https://github.com/actions/cache/blob/v1/README.md) for previous versions
32+
1133
## Usage
1234

1335
### Pre-requisites
1436
Create a workflow `.yml` file in your repositories `.github/workflows` directory. An [example workflow](#example-workflow) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
1537

1638
### Inputs
1739

18-
* `path` - A directory to store and save the cache
40+
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/master/packages/glob) for supported patterns.
1941
* `key` - An explicit key for restoring and saving the cache
2042
* `restore-keys` - An ordered list of keys to use for restoring the cache if no cache hit occurred for key
2143

@@ -46,7 +68,7 @@ jobs:
4668
4769
- name: Cache Primes
4870
id: cache-primes
49-
uses: actions/cache@v1
71+
uses: actions/cache@v2
5072
with:
5173
path: prime-numbers
5274
key: ${{ runner.os }}-primes
@@ -93,9 +115,11 @@ A cache key can include any of the contexts, functions, literals, and operators
93115
For example, using the [`hashFiles`](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#hashfiles) function allows you to create a new cache when dependencies change.
94116

95117
```yaml
96-
- uses: actions/cache@v1
118+
- uses: actions/cache@v2
97119
with:
98-
path: path/to/dependencies
120+
path: |
121+
path/to/dependencies
122+
some/other/dependencies
99123
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
100124
```
101125

@@ -109,7 +133,7 @@ Additionally, you can use arbitrary command output in a cache key, such as a dat
109133
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
110134
shell: bash
111135
112-
- uses: actions/cache@v1
136+
- uses: actions/cache@v2
113137
with:
114138
path: path/to/dependencies
115139
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }}
@@ -130,7 +154,7 @@ Example:
130154
steps:
131155
- uses: actions/checkout@v2
132156
133-
- uses: actions/cache@v1
157+
- uses: actions/cache@v2
134158
id: cache
135159
with:
136160
path: path/to/dependencies

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'Cache artifacts like dependencies and build outputs to improve wor
33
author: 'GitHub'
44
inputs:
55
path:
6-
description: 'A directory to store and save the cache'
6+
description: 'A list of files, directories, and wildcard patterns to cache and restore'
77
required: true
88
key:
99
description: 'An explicit key for restoring and saving the cache'

0 commit comments

Comments
 (0)