name: Release

on:
  push:
    branches: 
      - master

jobs:
  build:

    runs-on: ubuntu-latest 

    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1

    - name: Run tests and linting
      run: |
        npm install
        npm test
      env:
        CI: true

    - name: Create release using semantic-release
      run: npx semantic-release
      env:
        # GITHUB_TOKEN is added automatically by GitHub
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        CI: true
