name: Release and Publish to npm
on: workflow_dispatch
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source code
        uses: actions/checkout@v3
      - name: Install the dependencies
        run: npm ci
      - name: Initialize Git user
        run: |
          git config user.name "gkouziik"
          git config user.email "gkouziik@gmail.com"
      - name: Initialize the npm config
        run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
      - name: Run Release
        run: npm run release --ci
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
      - name: End message
        run: echo 'All done!'