name: Node.js Package

on: [push]

jobs:
  publish-npm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: |
              git submodule update --init
              git fetch --prune --unshallow --tags
      - uses: actions/setup-node@v2
        with:
          registry-url: 'https://registry.npmjs.org'
          always-auth: true
      - run: |
              cd vuejs
              npm install
              npm config set git-tag-version=false
              npm version $(git describe --tags --always)
              npm run build
              npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
