.github/workflows/nodejs.yml
name: nodejs
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
ci:
strategy:
matrix:
platform: [ubuntu-18.04, macos-latest, windows-latest]
node-version: [8.x, 10.x, 12.x]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Installing dependencies
run: yarn install --frozen-lockfile
- name: Linting codebase with ESLint & Prettier
run: yarn lint
- name: Type checking codebase
run: yarn typecheck || yarn check || echo "No typescript, no type checking"
publish-npm:
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org/'
- run: npm publish
if: github.event == 'push'
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}