mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 06:33:37 +08:00
refactor: 优化pnpm安装流程并合并重复的pnpm设置步骤
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user