name: release

on:
  push:
    tags:
      - "v[0-9]+.[0-9]+.[0-9]+"

jobs:
  create-release:
    name: Release crate
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Setup Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - name: Publish crate
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CRATES_IO_TOKEN }}
