name: Release scripts

on:
  release:
    types: [published]

jobs:
  release:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@v2
      - name: Install Node
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
          registry-url: "https://npm.pkg.github.com"
          scope: "@volcanic-uk"
      - name: Clean dependencies install
        run: npm install
        env:
          NODE_AUTH_TOKEN: ${{ secrets.CI_ACCESS_TOKEN }}
      - name: Build Ixcanul
        run: npm run build 
      - uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
          registry-url: 'https://registry.npmjs.org'
      - name: Publish
        run: npm publish --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
