name: Release
on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  release:
    name: release
    runs-on: [ubuntu-latest]
    steps:
    - name: Checkout repository
      uses: actions/checkout@v1
      with:
        fetch-depth: 1
    - name: Install correct toolchain
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
    - name: Run cargo check
      uses: actions-rs/cargo@v1
      with:
        command: check
    - name: login crates.io
      run: cargo login ${CRATES_IO_TOKEN}
      env:
        CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
    - name: publish
      run: cargo publish
