leptonica 0.4.0

Rust port of Leptonica image processing library
Documentation
name: CD

on:
  push:
    tags:
      - 'v*'

jobs:
  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable
        with:
          toolchain: stable

      - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2

      - name: fmt
        run: cargo fmt --all -- --check

      - name: clippy
        run: cargo clippy --all-features --all-targets -- -D warnings

      - name: test
        run: cargo test --all-features

      - name: Verify tag is on main
        run: |
          git fetch origin main
          if ! git merge-base --is-ancestor HEAD origin/main; then
            echo "Error: tag must be on main branch"
            exit 1
          fi

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