Skip to content

Update main.yml

Update main.yml #2

Workflow file for this run

name: Node.js CI and Release
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 14]
steps:
- uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- name: Generate coverage report
run: npm run coverage
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
release:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install dependencies
run: npm install
- name: Release to NPM
uses: npm/cli-github-action@v2
with:
email: ${{ secrets.NPM_EMAIL }}
token: ${{ secrets.NPM_TOKEN }}