name: Release

on:
  push:
    tags:
      - '*'

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Use Node (latest)
      uses: actions/setup-node@v1
      with:
        node_version: 12
    - name: Install
      run: yarn install --frozen-lockfile
    - name: Build
      run: yarn code:build
    - name: Lint
      run: yarn lint
    - name: Publish
      run: sh scripts/publish.sh
      env:
        REGISTRY_AUTH_TOKEN: ${{ secrets.REGISTRY_AUTH_TOKEN }}
        REGISTRY_URL: registry.npmjs.org
    - name: Create release notes
      run: sh scripts/github-release.sh
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
