name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  publish-crates:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Install protobuf compiler
        run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --no-verify --allow-dirty
