Skip to content

CI: Adds cache to node modules #6

CI: Adds cache to node modules

CI: Adds cache to node modules #6

Workflow file for this run

name: 'Run tests'
on: [push, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
# TODO: add version to a .nvmrc or at least a variable
node-version: 18.12.1
cache: npm
- name: Cache node modules
id: cache-packages
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ hashFiles('package-lock.json') }}
- name: Install
if: ${{ steps.cache-packages.outputs.cache-hit != 'true' }}
run: npm ci --omit=dev
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lib-${{ github.sha }}
path: ./dist
if-no-files-found: error