From 4d185db18ee1861e4c4c1aa892b755243ac7e02b Mon Sep 17 00:00:00 2001 From: Jared Hanson Date: Fri, 22 Nov 2024 19:07:10 -0800 Subject: [PATCH] Clean up workflow. --- .github/workflows/node.js.yml | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 50f7b7c..3602f68 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -33,8 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 - - id: setup-node - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} @@ -48,13 +47,6 @@ jobs: uses: apexskier/github-semver-parse@v1 with: version: ${{ steps.node-v.outputs.version }} - - - run: which jq - - - env: - N_MAJOR: ${{steps.node-version.outputs.major}} - N_MINOR: ${{steps.node-version.outputs.minor}} - run: echo "node - $N_MAJOR $N_MINOR" - id: npm-v name: Output npm version @@ -65,33 +57,23 @@ jobs: uses: apexskier/github-semver-parse@v1 with: version: ${{ steps.npm-v.outputs.version }} - - - env: - N_MAJOR: ${{steps.npm-version.outputs.major}} - N_MINOR: ${{steps.npm-version.outputs.minor}} - run: echo "npm - $N_MAJOR $N_MINOR" - id: lockfile-version - name: Get package lockfileVersion + name: Check package lockfileVersion run: echo "version=$(cat package-lock.json | jq '.lockfileVersion')" >> $GITHUB_OUTPUT if: hashFiles('package-lock.json') != '' - - - env: - N_MAJOR: ${{steps.lockfile-version.outputs.version}} - run: echo "lockfile - $N_MAJOR" - id: clean-install-v3 - name: Clean install with lockfileVersion >= 3 + name: Clean install run: npm ci if: steps.npm-version.outputs.major >= 7 && steps.lockfile-version.outputs.version >= 3 - id: clean-install-v3-compat - name: Install with lockfileVersion >= 3 + name: 'Install with lockfileVersion: 3 for compatibility with npm v6' run: npm install if: steps.npm-version.outputs.major < 7 && steps.npm-version.outputs.major >= 5 && steps.lockfile-version.outputs.version >= 3 - - id: clean-install - name: Clean install + - name: Clean install run: npm ci # The [`ci`][1] command was [introduced][2] with npm@5, and is intended to # be used in continuous integration environments. If npm@5 or later is @@ -104,8 +86,8 @@ jobs: if: steps.npm-version.outputs.major >= 5 && steps.lockfile-version.outputs.version != null && steps.clean-install-v3.outcome == 'skipped' && steps.clean-install-v3-compat.outcome == 'skipped' - - run: npm install - name: Install + - name: Install + run: npm install if: steps.npm-version.outputs.major < 5 || steps.lockfile-version.outputs.version == null - run: npm test