on:
  release:
    types: [created]

name: Publish to crate

jobs:
  publish:
    name: Publish to cargo
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - run: cargo test

      - uses: katyo/publish-crates@v1
        with:
          registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
