From 11b8e76f10de45fcfcfb52aa3da89431092b9b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E5=BF=83=E7=A6=BE?= Date: Sun, 13 Aug 2023 16:44:00 +0800 Subject: [PATCH] Update GitHub Actions workflow caching mechanism --- .github/workflows/build.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2616d2f..0c19c40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build artifacts on: push: - branches: ["main"] + branches: [main] jobs: build: @@ -28,7 +28,7 @@ jobs: - name: Use Node.js LTS uses: actions/setup-node@v3 with: - node-version: "lts/*" + node-version: lts/* cache: pnpm - name: Install dependencies @@ -37,8 +37,11 @@ jobs: - name: Next.js build cache uses: actions/cache@v3 with: - path: packages/viewer/.next/ - key: ${{ runner.os }}-next + path: packages/viewer/.next/cache/ + key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('packages/viewer/**/*.[jt]s', 'packages/viewer/**/*.[jt]sx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}- + ${{ runner.os }}-nextjs- - name: Build run: pnpm -r run build @@ -48,11 +51,9 @@ jobs: with: name: luogu-discussion-archive path: packages/archive/dist/ - retention-days: 1 - name: Upload luogu-discussion-viewer uses: actions/upload-artifact@v3 with: name: luogu-discussion-viewer path: packages/viewer/.next/ - retention-days: 1