pyo3-dlpack 0.3.0

Zero-copy DLPack tensor interop for PyO3
Documentation
name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  publish-crate:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
      - name: Verify tag matches Cargo.toml version
        run: |
          TAG="${GITHUB_REF_NAME#v}"
          VERSION=$(grep -m1 '^version = ' Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
          if [ "$TAG" != "$VERSION" ]; then
            echo "Tag v$TAG does not match Cargo.toml version $VERSION"
            exit 1
          fi
      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          if [ -n "$CARGO_REGISTRY_TOKEN" ]; then
            cargo publish
          else
            echo "CARGO_REGISTRY_TOKEN not set, skipping publish"
          fi

  github-release:
    name: GitHub Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: softprops/action-gh-release@v3
        with:
          generate_release_notes: true