mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 14:50:48 +08:00
feat: 更新 .npmrc 文件以添加注释并简化 node 版本提取逻辑
This commit is contained in:
2
.npmrc
2
.npmrc
@ -1 +1 @@
|
|||||||
use-node-version=22.9.0
|
use-node-version=22.9.0 # https://pnpm.io/zh/npmrc#use-node-version
|
@ -67,15 +67,10 @@ runs:
|
|||||||
|
|
||||||
|
|
||||||
# Extract the node version from the .npmrc file
|
# Extract the node version from the .npmrc file
|
||||||
set -x;
|
nodeVersion=$(sed -n 's/.*use-node-version=\([0-9.]*\).*/\1/p' .npmrc)
|
||||||
if [ -f ".npmrc" ]; then
|
if [[ -z "$nodeVersion" ]]; then
|
||||||
nodeVersion=$(grep 'use-node-version=' .npmrc | sed -E 's/^use-node-version=([0-9.]+).*/\1/')
|
|
||||||
fi
|
|
||||||
if [ -z "$nodeVersion" ]; then
|
|
||||||
nodeVersion="lts/*"
|
nodeVersion="lts/*"
|
||||||
fi
|
fi
|
||||||
echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT
|
|
||||||
sed -i '/use-node-version/d' .npmrc
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v4 # https://github.com/pnpm/action-setup?tab=readme-ov-file#inputs
|
- uses: pnpm/action-setup@v4 # https://github.com/pnpm/action-setup?tab=readme-ov-file#inputs
|
||||||
if: steps.prepare.outputs.setup-pnpm == 'true'
|
if: steps.prepare.outputs.setup-pnpm == 'true'
|
||||||
|
Reference in New Issue
Block a user