name: release-automated
on:
  push:
    branches: [ master, release, alpha, beta ]
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          persist-credentials: false
      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: 14
      - name: Cache Node.js modules
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
              ${{ runner.os }}-node-
      - name: Install dependencies
        run: npm ci
      - name: Run semantic-release
        run: npx semantic-release
        env:
          GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
