From 4f06f56754ac118f043cb20c2eee0df416ef2280 Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Sun, 9 Jul 2023 06:24:36 +0000 Subject: [PATCH] build(ci): cache pnpm store. --- .../workflows/build-and-deploy-by-ftp.yaml | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-by-ftp.yaml b/.github/workflows/build-and-deploy-by-ftp.yaml index 99e6a4a..8af6f1e 100644 --- a/.github/workflows/build-and-deploy-by-ftp.yaml +++ b/.github/workflows/build-and-deploy-by-ftp.yaml @@ -18,8 +18,30 @@ jobs: with: node-version: 16 - - run: npm i --location=global pnpm@7 - - run: pnpm i + - uses: https://github.com/pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: https://github.com/actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + - run: pnpm build - run: npm run export