You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.4 KiB
YAML
73 lines
1.4 KiB
YAML
name: Test & Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [ '12', '14', '16' ]
|
|
|
|
steps:
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Audit
|
|
run: npm audit --production
|
|
|
|
- name: Install packages
|
|
run: npm install
|
|
|
|
- name: Test
|
|
run: npm test
|
|
|
|
deploy:
|
|
|
|
needs: [ test ]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push'
|
|
|
|
steps:
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install packages
|
|
run: npm install
|
|
|
|
- name: Deploy @latest version to npm
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: JS-DevTools/npm-publish@v1
|
|
with:
|
|
token: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Update @next version
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
run: npm version prerelease --no-git-tag-version --preid "$GITHUB_RUN_NUMBER"
|
|
|
|
- name: Deploy @next version to npm
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
uses: JS-DevTools/npm-publish@v1
|
|
with:
|
|
tag: next
|
|
token: ${{ secrets.NPM_TOKEN }}
|
|
check-version: false
|