feat: add .nvrmc and improve workflows (#36)

This commit is contained in:
Martin Domajnko
2024-04-09 09:00:55 +02:00
committed by GitHub
parent 89bcad602d
commit 18db381b89
3 changed files with 17 additions and 23 deletions

View File

@@ -1,37 +1,26 @@
name: RUN ES LINT ANS TESTS
name: Build, Lint and Test
on: push
jobs:
build:
strategy:
matrix:
version: ['lts/*']
timeout-minutes: 7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
node-version: 'lts/*'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
key: cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Install modules
- name: Install dependencies
run: npm ci
- name: Run Prettier
@@ -40,5 +29,8 @@ jobs:
- name: Run ESLint
run: npm run lint:check
- name: Build
run: npm run build
- name: Run Tests
run: npm run test

View File

@@ -8,11 +8,12 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org/
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm publish

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
v20.11.1