From 6ae58c539433234c6c4bdd23be072e6f38076616 Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Wed, 25 Dec 2024 00:23:32 +0800 Subject: [PATCH] fix: npm cache --- .github/workflows/beta_site.yml | 13 ++++++++++++- .github/workflows/site.yml | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/beta_site.yml b/.github/workflows/beta_site.yml index f3a5878fa4d..d107a7036e6 100644 --- a/.github/workflows/beta_site.yml +++ b/.github/workflows/beta_site.yml @@ -18,7 +18,11 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 18 - cache: npm + cache: 'pnpm' + + # 添加 pnpm 安装 + - name: Install pnpm + run: npm install -g pnpm # 安装根目录依赖 - name: Install root dependencies @@ -28,6 +32,13 @@ jobs: - name: Build root project run: pnpm run build --if-present + # site 目录使用 npm,需要单独配置 npm 缓存 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + cache-dependency-path: site/package-lock.json + # 安装和构建 site 目录 - name: Install and build site working-directory: site diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 38536b5def9..6c272dd441e 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -30,11 +30,11 @@ jobs: # 安装根目录依赖 - name: Install root dependencies - run: pnpm install + run: npm install # 构建根目录项目 - name: Build root project - run: pnpm run build --if-present + run: npm run build --if-present # 安装和构建 site 目录 - name: Install and build site