From e3f95cd69bbe69a1431e75aaecc68c8339a7d264 Mon Sep 17 00:00:00 2001 From: coolxitech Date: Sun, 14 Dec 2025 12:23:03 +0800 Subject: [PATCH] =?UTF-8?q?chore(workflow):=20=E8=BF=81=E7=A7=BB=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=B5=81=E7=A8=8B=E8=87=B3=20pnpm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 GitHub Actions 中安装 pnpm 并指定版本为 8 - 将 Node.js 缓存策略从 npm 更改为 pnpm - 使用 pnpm 替代 npm 安装依赖和执行构建命令 - 更新 Electron 构建脚本参数传递方式以适配 pnpm - 移除冗余的 npm 配置并统一使用 pnpm 管理前端依赖 --- .github/workflows/build.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ff85fb..ee9e083 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,11 +26,16 @@ jobs: steps: - uses: actions/checkout@v4 + # 安装 pnpm + - uses: pnpm/action-setup@v3 + with: + version: 8 + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' + cache: 'pnpm' - name: Setup Go uses: actions/setup-go@v5 @@ -39,10 +44,10 @@ jobs: # 构建服务端前先构建前端 - name: Install Frontend Dependencies - run: npm install + run: pnpm install - name: Build Frontend (for Go Embed) - run: npm run build + run: pnpm run build - name: Compile Go Server shell: bash @@ -75,20 +80,26 @@ jobs: steps: - uses: actions/checkout@v4 + # 安装 pnpm + - uses: pnpm/action-setup@v3 + with: + version: 8 + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' + cache: 'pnpm' - name: Install Dependencies - run: npm install + run: pnpm install - name: Build Frontend (for Electron) - run: npm run build + run: pnpm run build - name: Build Electron App - run: npm run build:electron -- --${{ matrix.platform }} + # 注意: pnpm 传参不需要额外的 -- + run: pnpm run build:electron --${{ matrix.platform }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}