silk-graph 0.2.4

Merkle-CRDT graph engine for distributed, conflict-free knowledge graphs
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

permissions:
  contents: write

jobs:
  build-wheels:
    name: Build wheel (${{ matrix.os }} / ${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          # Linux x86_64 (most servers, CI runners). Built in a manylinux
          # container so PyPI accepts the wheel — host builds get tagged
          # `linux_x86_64` which PyPI rejects. --interpreter points maturin
          # at the container's Python (host's Python is not on PATH inside).
          - os: ubuntu-latest
            target: x86_64
            manylinux: 'auto'
            extra-args: '--interpreter 3.12'
          # Linux aarch64 (ARM servers, Docker on Apple Silicon, RPi 64-bit).
          # Same container + --interpreter pattern, cross-compiled.
          - os: ubuntu-latest
            target: aarch64
            manylinux: 'auto'
            extra-args: '--interpreter 3.12'
          # macOS arm64 (Apple Silicon).
          - os: macos-14
            target: aarch64
            manylinux: 'off'
            extra-args: ''
          # Windows x86_64.
          - os: windows-latest
            target: x64
            manylinux: 'off'
            extra-args: ''
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Build wheel
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          args: --release --out dist ${{ matrix.extra-args }}
          manylinux: ${{ matrix.manylinux }}
      - uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.target }}
          path: dist

  build-sdist:
    name: Build source distribution
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build sdist
        uses: PyO3/maturin-action@v1
        with:
          command: sdist
          args: --out dist
      - uses: actions/upload-artifact@v4
        with:
          name: sdist
          path: dist

  publish-pypi:
    name: Publish to PyPI
    needs: [build-wheels, build-sdist]
    runs-on: ubuntu-latest
    environment: pypi
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - uses: actions/download-artifact@v4
        with:
          name: sdist
          path: dist
      - uses: pypa/gh-action-pypi-publish@release/v1

  publish-crates:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    continue-on-error: true
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Publish
        run: cargo publish --allow-dirty
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}

  github-release:
    name: Create GitHub Release
    needs: [publish-pypi]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - uses: actions/download-artifact@v4
        with:
          name: sdist
          path: dist
      - name: Create release
        uses: softprops/action-gh-release@v2
        with:
          files: dist/*
          generate_release_notes: true