From ece02cfd1307a091d565b0fdf5e6e9101e7dd412 Mon Sep 17 00:00:00 2001 From: Sceat Date: Wed, 3 Jul 2024 00:50:34 +0900 Subject: [PATCH] ci: improve caching --- .github/workflows/ci.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11cb9c55..d27b0477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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') }} @@ -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 @@ -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- @@ -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-