Skip to content

Update build.yml

Update build.yml #203

Workflow file for this run

name: Node CI
on: [ push, pull_request ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 14, 16, 18, 20 ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- uses: sarisia/actions-status-discord@v1
# Only fire alert once
if: github.ref == 'refs/heads/main' && failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "build and test"
color: 0x222222
username: GitHub Actions
publish:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm install
- name: Publish @RC to npm
if: contains(github.ref, 'RC')
run: npm publish --tag RC
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish @latest to npm
if: contains(github.ref, 'RC') == false
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "npm publish"
color: 0x222222
username: GitHub Actions