name: Node.js CI

on:
  release:
    types: [published]
jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20.x'
          registry-url: 'https://registry.npmjs.org'
          cache: 'yarn'
          scope: '@talkamatic'
      - run: yarn
      - run: yarn compile
      - run: yarn build
      - name: Publish to NPM registry
        run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
