name: Node CI on: [push] jobs: tests: name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: node-version: [14.x, 16.x, 18.x] os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v1 - name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Install dependencies run: yarn --frozen-lockfile --ignore-optional env: CI: true - name: Lint run: yarn lint env: CI: true - name: Test run: yarn test - name: Build run: yarn build env: CI: true publish: name: Publish to NPM runs-on: ubuntu-latest needs: - tests steps: - uses: actions/checkout@master - uses: actions/setup-node@v1 with: node-version: 16.x registry-url: https://registry.npmjs.org - name: install global module run: | npm install -g yarn if: contains(github.ref, 'tags/v') - name: Install dependencies run: yarn install --frozen-lockfile --ignore-optional if: contains(github.ref, 'tags/v') env: CI: true - name: Build run: yarn build if: contains(github.ref, 'tags/v') - name: Publish to NPM run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} if: contains(github.ref, 'tags/v')