ikat 0.2.1

Weave Markdown into camera-ready LaTeX: mermaid-to-TikZ, pgfplots figures, publisher templates
Documentation
name: release

# Ship a version: push tag vX.Y.Z (must match Cargo.toml + pyproject).
# PyPI wheels and the crates.io publish run in parallel.

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

jobs:
  check-tag:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Tag matches package versions
        run: |
          test "v$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml)" = "${{ github.ref_name }}" \
            || { echo "::error::tag does not match Cargo.toml"; exit 1; }
          test "v$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)" = "${{ github.ref_name }}" \
            || { echo "::error::tag does not match pyproject.toml"; exit 1; }

  pypi-wheels:
    needs: check-tag
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          command: build
          args: --release --out dist --find-interpreter
          manylinux: auto
      - name: Build sdist (linux only)
        if: matrix.os == 'ubuntu-latest'
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist
      - uses: actions/upload-artifact@v4
        with:
          name: dist-${{ matrix.os }}
          path: dist/

  pypi-publish:
    needs: pypi-wheels
    runs-on: ubuntu-latest
    permissions:
      id-token: write # trusted publishing (OIDC): no API token
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: dist-*
          path: dist
          merge-multiple: true
      - uses: pypa/gh-action-pypi-publish@release/v1
        # Trusted publishing: the ikat PyPI project needs this repo +
        # workflow registered as a (pending) publisher. No password.

  crates-publish:
    needs: check-tag
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish to crates.io
        run: cargo publish --locked
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}