name: Automatic Deployment

on:
  push:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node env
        uses: actions/setup-node@v2
        with:
          node-version: '18.x'
          registry-url: 'https://registry.npmjs.org'
      - name: Welcome
        run: echo Start deploying Project Balancer
      - name: Install dependencies
        run: |
          npm install
      - name: Build the program and library
        run: |
          npm run build
      - name: Publish the package
        run: npm publish --access=public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
