name: Publish formio-gds-template to npm

on:
  release:
    types: [created]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16
          registry-url: 'https://registry.npmjs.org'
      - name: Install dependencies
        run: |
          rm -rf node_modules
          npm ci
      - name: Build package
        run: npm run prepublish
      - name: Publish package to npm
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.FORMIO_GDS_TEMPLATE_TOKEN }}
