refactor: 优化pnpm安装流程并合并重复的pnpm设置步骤

This commit is contained in:
Lyda
2025-09-18 11:43:21 +08:00
parent 86d6bb988f
commit 64403850ee

View File

@@ -129,8 +129,8 @@ runs:
restore-keys: | restore-keys: |
${{ runner.os }}-corepack-pnpm- ${{ runner.os }}-corepack-pnpm-
- name: 确保 pnpm 可用(用于计算 store 路径) - name: 确保 pnpm 可用
if: inputs.package-manager == 'pnpm' && inputs.cache-mode == 'store' if: inputs.package-manager == 'pnpm'
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
with: with:
version: ${{ inputs.pnpm-version }} version: ${{ inputs.pnpm-version }}
@@ -186,18 +186,15 @@ runs:
shell: bash shell: bash
run: | run: |
if [[ "${{ steps.cache.outputs.cache-hit }}" == "true" ]]; then if [[ "${{ steps.cache.outputs.cache-hit }}" == "true" ]]; then
echo "✅ 缓存命中,跳过依赖安装" if [[ "${{ inputs.cache-mode }}" == "store" ]]; then
echo "✅ 缓存命中store将执行快速链接安装不会下载包仅链接"
else
echo "✅ 缓存命中,跳过依赖安装"
fi
else else
echo "⚠️ 缓存未命中,开始安装依赖" echo "⚠️ 缓存未命中,开始安装依赖"
fi fi
- name: 确保 pnpm 可用(如需)
if: inputs.package-manager == 'pnpm'
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
run_install: false
- name: 安装依赖 - name: 安装依赖
if: (inputs.cache-mode == 'node_modules' && steps.cache.outputs.cache-hit != 'true') || (inputs.cache-mode == 'store') if: (inputs.cache-mode == 'node_modules' && steps.cache.outputs.cache-hit != 'true') || (inputs.cache-mode == 'store')
shell: bash shell: bash