pd200x 0.1.0

Async Rust driver for the Maono PD200X USB microphone
Documentation
name: Release

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

jobs:
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    # Only publish from the upstream repo, not forks
    if: github.repository == 'advnpzn/pd200x'
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - name: Verify crate version matches tag
        run: |
          CARGO_VERSION="v$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
          GIT_TAG="${GITHUB_REF_NAME}"
          if [ "$CARGO_VERSION" != "$GIT_TAG" ]; then
            echo "Version mismatch: Cargo.toml has $CARGO_VERSION but tag is $GIT_TAG"
            exit 1
          fi

      - name: Publish
        run: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}