name: Publish
on:
    release:
        types: [created]
jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v2
              with:
                  persist-credentials: false
            - name: Reconfigure git to use HTTP authentication
              run: >
                  git config --global url."https://github.com/".insteadOf
                  ssh://git@github.com/
            # Setup .npmrc file to publish to GitHub Packages
            - uses: actions/setup-node@v2
              with:
                  node-version: '12.x'
                  registry-url: 'https://registry.npmjs.org'
            - run: npm ci
            - run: npm publish
              env:
                  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
