From 259c4be04b87824e0a259c95b0017cd7c2d31283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 1 Feb 2024 12:21:35 +0100 Subject: [PATCH] chore: update node.yml --- .github/workflows/node.yml | 41 ++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index acd3d91..8c4aabf 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -1,46 +1,43 @@ name: Node -on: - pull_request: - push: - branches: - - main +on: pull_request permissions: contents: read -concurrency: +concurrency: group: node-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [14, 16, 18] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - name: build steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up node ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 + id: versions with: - node-version: ${{ matrix.node-version }} + fallbackNode: '^20' + fallbackNpm: '^10' - - name: Install dependencies - run: npm ci + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3 + 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: Build - run: npm run build + - name: Install dependencies & build + run: | + npm ci + npm run build --if-present - name: Check build changes - # See https://github.com/skjnldsv/check-actor-permission/blob/main/action.yml#L27 - if: matrix.node-version == 16 run: | bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"