From a0f02d693e3df756fe993361b11cc351fd9b737f Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Wed, 11 Sep 2024 10:08:33 +0200 Subject: [PATCH] fix(cypress): read npm and node versions from package.json Signed-off-by: skjnldsv --- .github/workflows/cypress.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 7d7ac349ff..36e092ea38 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -42,13 +42,6 @@ jobs: - "9980:9980" steps: - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: ${{ matrix.node-version }} - - name: Set up npm7 - run: npm i -g npm@7 - - name: Checkout server uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -81,6 +74,21 @@ jobs: with: path: apps/${{ env.APP_NAME }} + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 + id: versions + with: + fallbackNode: "^20" + fallbackNpm: "^9" + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' + - name: Set up php ${{ matrix.php-versions }} uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 with: