name: Publish NPM Release

on:
  push:
    tags:
      - '*'
  workflow_dispatch:

jobs:
  publish:
    name: Publish to npmjs registry
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup
        uses: ./.github/actions/setup-js

      - name: Store auth token in config file
        run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

      - name: yarn publish
        run: yarn publish
        working-directory: javascript
