mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-13 06:40:49 +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
|
||||
set -x;
|
||||
if [ -f ".npmrc" ]; then
|
||||
nodeVersion=$(grep 'use-node-version=' .npmrc | sed -E 's/^use-node-version=([0-9.]+).*/\1/')
|
||||
fi
|
||||
if [ -z "$nodeVersion" ]; then
|
||||
nodeVersion=$(sed -n 's/.*use-node-version=\([0-9.]*\).*/\1/p' .npmrc)
|
||||
if [[ -z "$nodeVersion" ]]; then
|
||||
nodeVersion="lts/*"
|
||||
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
|
||||
if: steps.prepare.outputs.setup-pnpm == 'true'
|
||||
|
Reference in New Issue
Block a user