name: Release
on:
  push:
    branches:
      - master
      - beta
      - alpha
      - next

jobs:
  release:
    name: Release
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Use Node.js 10.x
        uses: actions/setup-node@v1
        with:
          node-version: '10.x'
      - name: Clean up
        run: rm -rf docs test # We don't need to deploy the docs and test folders to npm, this just makes the library bigger unnecessarily.
      - name: Install
        run: npm install
      - name: Run lint
        run: |
          npm run lint
      - name: Build
        run: |
          npm run build
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN_PHL }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release
