From 55c4c305c0b0877d0564199ad358f30ef722876c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Sat, 12 Oct 2024 15:27:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20setup-node-environ?= =?UTF-8?q?ment.yml=20=E5=92=8C=20action.yml=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E6=9C=AA=E6=8C=87=E5=AE=9A=20Node=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E9=BB=98=E8=AE=A4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/setup-node-environment.yml | 5 ----- setup-node-environment/action.yml | 5 ++++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/setup-node-environment.yml b/.github/workflows/setup-node-environment.yml index 4605645..e6cf8fe 100644 --- a/.github/workflows/setup-node-environment.yml +++ b/.github/workflows/setup-node-environment.yml @@ -43,11 +43,6 @@ jobs: sed -i '/use-node-version/d' .npmrc node -v; - set -x; - nodeVersion=$(grep 'use-node-version=' .npmrc | sed -E 's/^use-node-version=([0-9.]+).*/\1/') - echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT - sed -i '/use-node-version/d' .npmrc - - uses: yanhao98/composite-actions/setup-node-environment@main - name: Check Node and PNPM versions diff --git a/setup-node-environment/action.yml b/setup-node-environment/action.yml index 72b7565..d8cb431 100644 --- a/setup-node-environment/action.yml +++ b/setup-node-environment/action.yml @@ -69,6 +69,9 @@ runs: # Extract the node version from the .npmrc file set -x; nodeVersion=$(grep 'use-node-version=' .npmrc | sed -E 's/^use-node-version=([0-9.]+).*/\1/') + if [ -z "$nodeVersion" ]; then + nodeVersion="lts/*" + fi echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT sed -i '/use-node-version/d' .npmrc @@ -76,7 +79,7 @@ runs: if: steps.prepare.outputs.setup-pnpm == 'true' - uses: actions/setup-node@v4 # https://github.com/actions/setup-node?tab=readme-ov-file#usage with: - node-version: ${{ steps.prepare.outputs.node-version || 'lts/*' }} + node-version: ${{ steps.prepare.outputs.node-version }} cache: ${{ steps.prepare.outputs.cache }} - name: 📦 Install Project Dependencies if: steps.prepare.outputs.pnpm-lock-exists == 'true'