Merge pull request #9 from hildjj/cache-docs

Adds documentation hints for caching
This commit is contained in:
Khải 2021-02-18 08:31:04 +07:00 committed by GitHub
commit 9facd4db8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,7 @@ jobs:
steps: steps:
- uses: pnpm/action-setup@v1.2.1 - uses: pnpm/action-setup@v1.2.1
with: with:
version: 4.11.1 version: 5.17.2
``` ```
### Install PNPM and a few NPM packages ### Install PNPM and a few NPM packages
@ -85,13 +85,45 @@ jobs:
- uses: pnpm/action-setup@v1.2.1 - uses: pnpm/action-setup@v1.2.1
with: with:
version: 4.11.1 version: 5.17.2
run_install: | run_install: |
- recursive: true - recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies] args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript] - args: [--global, gulp, prettier, typescript]
``` ```
### Use cache to reduce installation time
```yaml
on:
- push
- pull_request
jobs:
runs-on: ubuntu-latest
steps:
build:
- uses: actions/checkout@v2
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/action-setup@v1.2.1
with:
version: 5.17.2
run_install: true
```
**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that.
## Notes ## Notes
This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself. This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself.