name: Release

on:
  release:
    types: [created]

jobs:
  release:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [16.x]
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Use Node.js ${{ matrix.node }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}

      - name: Prepare the build
        run: |
          npm ci
          npm run lint
          npm run build --if-present

      - name: Publish
        uses: JS-DevTools/npm-publish@v1
        with:
          token: ${{ secrets.NPM_TOKEN }}
