Skip to content

Merge pull request #2 from olisto/scope #2

Merge pull request #2 from olisto/scope

Merge pull request #2 from olisto/scope #2

Workflow file for this run

# This workflow will lint, run tests and then publish a package to NPM when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js test and publish
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
jobs:
test-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: check version against release tag
if: ${{ github.event_name == 'release' }}
uses: dreusel/match-tag-to-package-version@master
with:
TAG_PREFIX: v
- name: set NPM token
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- name: install dependencies
run: npm install
- name: test
run: npm test
- name: publish
if: ${{ github.event_name == 'release' }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: npm publish