name: CD

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

jobs:
  publish-cargo:
    name: Publishing to Cargo
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          profile: minimal
          override: true
      - uses: Swatinem/rust-cache@v2
      - uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token ${{ secrets.CARGO_API_KEY }}
