Skip to content

Commit

Permalink
Add cache to node workflows (mainmatter#2369)
Browse files Browse the repository at this point in the history
* ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows

* style(workflow): restore single quotes

* fix(workflows): use 'yarn' cache instead of 'npm'

Co-authored-by: Marco Otte-Witte <[email protected]>

* ci(workflow): remove redundant cache step

* ci(workflow): remove unused cache steps

* ci(workflow): remove unused 'cache' option from release workflow

Co-authored-by: Oscar Dominguez <[email protected]>
  • Loading branch information
marcoow and oscard0m authored Apr 29, 2022
1 parent bb636f9 commit 5aab427
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 49 deletions.
56 changes: 8 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x

- name: get yarn cache dir
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-lint-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn

- name: install dependencies
run: yarn install
Expand Down Expand Up @@ -95,20 +85,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x

- name: get yarn cache dir
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn

- name: install dependencies
run: yarn install
Expand All @@ -130,20 +110,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x

- name: get yarn cache dir
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn

- name: install dependencies
run: yarn install --no-lockfile
Expand All @@ -158,20 +128,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x

- name: get yarn cache dir
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-test-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: yarn

- name: install dependencies
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: 'https://registry.npmjs.org'
Expand Down

0 comments on commit 5aab427

Please sign in to comment.