Skip to content

Node.js Package

Node.js Package #54

name: Node.js Package
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types: [published]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['18', '20', '21']
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- run: npm i
- run: npm run build --if-present
- run: npm run lint --if-present
- run: npm test
publish-npm:
if: github.event == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-gpr:
if: github.event == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm run build --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GH_TOKEN}}