name: Auto Publisher

on:
  push:
    branches:
      - master

jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          registry-url: https://registry.npmjs.org/
      - name: Install pnpm
        run: npm i pnpm -g
      - run: npm run setup
      - run: npm run publish
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
          ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
          ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
          REGISTRY: https://registry.npmjs.org
