Skip to content

Commit

Permalink
Clean up workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Nov 23, 2024
1 parent ca39236 commit 4d185db
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 4d185db

Please sign in to comment.