img_src 0.3.2

Rust SDK for img-src image processing and delivery API
Documentation
name: CD

on:
  push:
    tags: ["v*"]

permissions:
  contents: read

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      - name: Verify tag matches Cargo.toml version
        run: |
          TAG="${GITHUB_REF#refs/tags/v}"
          CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
          if [ "$TAG" != "$CARGO_VERSION" ]; then
            echo "::error::Tag v${TAG} does not match Cargo.toml version ${CARGO_VERSION}"
            exit 1
          fi

      - name: Build
        run: cargo build

      - name: Test
        run: cargo test --test models_test --test apis_test

      - name: Publish to crates.io
        run: cargo publish --token "$CARGO_REGISTRY_TOKEN"
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}