.github/workflows/publish.yml
name: Publish
on:
push:
branches-ignore:
- '**'
tags:
- v?[0-9]+.[0-9]+.[0-9]+
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- name: Checkout the repository
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install NPM dependencies
run: npm install
- name: Run test converage
run: npm run coverage
publish-npm:
name: Publish on NPM
runs-on: ubuntu-latest
needs: [tests]
steps:
- name: Checkout the repository
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- name: Run NPM ci
run: npm ci
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-gpr:
name: Publish on GPR
runs-on: ubuntu-latest
needs: [tests, publish-npm]
steps:
- name: Checkout the repository
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com/
- name: Run NPM ci
run: npm ci
- name: Publish to GPR
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}