build: Upgrade to Node 20 #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lockfile check for Node v20 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
version-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read Node.js version from .nvmrc | |
id: read-nvmrc | |
run: | | |
if [ -f .nvmrc ]; then | |
NODE_VERSION=$(cat .nvmrc) | |
echo "node-version=$NODE_VERSION" >> $GITHUB_ENV | |
else | |
echo "No .nvmrc file found, defaulting to Node.js v20" | |
echo "node-version=20" >> $GITHUB_ENV | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Retrieve version | |
id: getversion | |
run: | | |
echo "VERSION=$(cat package-lock.json | grep '\"lockfileVersion\": 3,')" >> $GITHUB_ENV | |
- name: Check value | |
if: ${{ env.VERSION == null }} | |
run: | | |
echo "ERROR: Outdated package-lock file. Use NPM9 to install dependencies " | |
exit 1 | |
- name: Check sync | |
run: | | |
problems=$(npm ls --all --package-lock-only --json | jq '.problems[]?' -r) | |
if [[ -n "$problems" ]]; then | |
echo "$problems" | |
echo | |
echo "Mismatch between package.json and package-lock.json. Please regenerate package lock file with 'npm install'." | |
exit 1 | |
fi |