name: ci

on:
  push:
    branches:
      - master
      - ci
      - dev
    tags:
      - '*'
  pull_request:
    branches:
      - master
  workflow_dispatch:

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: 20.x
          registry-url: https://registry.npmjs.org/
      - name: Build
        run: |
          npm install
          npm run build
      - name: Deploy to npm
        if: ${{ github.event_name == 'push' }}
        run: |
          npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{secrets.npm_token}}
