diff --git a/.npmrc b/.npmrc index e989a26..1b788bf 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -use-node-version=22.9.0 \ No newline at end of file +use-node-version=22.9.0 # https://pnpm.io/zh/npmrc#use-node-version \ No newline at end of file diff --git a/setup-node-environment/action.yml b/setup-node-environment/action.yml index af20e8e..10ff407 100644 --- a/setup-node-environment/action.yml +++ b/setup-node-environment/action.yml @@ -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'