Skip to content

Commit

Permalink
ci: improve caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Sceat committed Jul 2, 2024
1 parent fd22e5c commit ece02cf
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
with:
node-version: 20

- name: Cache Node.js modules
id: cache-node-modules
uses: actions/cache@v3
- name: Restore Node.js modules cache
id: cache-node-modules-restore
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
Expand All @@ -30,12 +30,17 @@ jobs:
- name: Install dependencies
run: npm install
if: steps.cache-node-modules-restore.outputs.cache-hit != 'true'

- name: Install Vercel CLI
run: npm install -g vercel

outputs:
cache-key: ${{ steps.cache-node-modules.outputs.cache-hit }}
- name: Save Node.js modules cache
id: cache-node-modules-save
uses: actions/cache/save@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}

deploy-mainnet:
needs: install
Expand All @@ -47,10 +52,10 @@ jobs:
uses: actions/checkout@v4

- name: Restore Node.js modules cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ needs.install.outputs.cache-key }}
key: ${{ needs.install.outputs.cache-node-modules-restore.outputs.cache-primary-key }}
restore-keys: |
${{ runner.os }}-node-
Expand Down Expand Up @@ -82,10 +87,10 @@ jobs:
uses: actions/checkout@v4

- name: Restore Node.js modules cache
uses: actions/cache@v3
uses: actions/cache/restore@v4
with:
path: ~/.npm
key: ${{ needs.install.outputs.cache-key }}
key: ${{ needs.install.outputs.cache-node-modules-restore.outputs.cache-primary-key }}
restore-keys: |
${{ runner.os }}-node-
Expand Down

0 comments on commit ece02cf

Please sign in to comment.