name: Release
on:
  push:
    tags:
      - '[0-9]+.[0-9]+.[0-9]+'

jobs:
  release:
    runs-on: ubuntu-latest
    environment: release
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
            node-version: '18'
            cache: 'yarn'
            registry-url: https://registry.npmjs.org/
      - name: Install dependencies
        run: yarn
      - name: Test
        run: yarn test
      - name: Lint
        run: yarn lint
      - run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
      - name: Documentation
        run: yarn doc:deploy
