minigraf 0.23.0

Zero-config, single-file, embedded graph database with bi-temporal Datalog queries
Documentation
name: Python Release

on:
  workflow_call:
    inputs:
      tag:
        # Reserved: the release tag (e.g. "v0.22.0") passed from release.yml.
        # Available as ${{ inputs.tag }} for future use (e.g. annotating wheel metadata).
        required: true
        type: string
  workflow_dispatch:
    inputs:
      tag:
        # The release tag to publish wheels for (e.g. "v0.22.0").
        required: true
        type: string

jobs:
  build-wheels:
    name: Build wheel (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            build_args: --release --manylinux 2014 --out dist
          - os: ubuntu-24.04-arm
            build_args: --release --manylinux 2014 --out dist
          - os: macos-14
            build_args: --release --target universal2-apple-darwin --out dist
          - os: windows-latest
            build_args: --release --out dist

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: x86_64-apple-darwin  # needed for universal2 on macos-14 (arm)

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install maturin
        run: pip install "maturin>=1.5"

      - name: Build wheel (workaround for maturin workspace uniffi-bindgen bug)
        working-directory: minigraf-ffi/python
        run: bash build.sh build ${{ matrix.build_args }}
        shell: bash

      - name: Upload wheel
        uses: actions/upload-artifact@v4
        with:
          name: python-wheel-${{ matrix.os }}
          path: minigraf-ffi/python/dist/*.whl

  publish:
    name: Publish to PyPI
    needs: build-wheels
    runs-on: ubuntu-latest
    environment:
      name: pypi
      url: https://pypi.org/p/minigraf
    permissions:
      id-token: write  # for PyPI trusted publishing

    steps:
      - name: Download all wheels
        uses: actions/download-artifact@v4
        with:
          pattern: python-wheel-*
          path: dist
          merge-multiple: true

      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: dist/