name: Release

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:

  release:
    name: Publish to crates.io
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Install latests rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          default: true
          override: true
      - name: Publish to crates.io
        env:
          CARGO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
        run: |
          cargo publish --token "${CARGO_TOKEN}"