outlines-core 0.2.14

Structured Generation
Documentation
name: Publish PyPi & crates.io

on:
  workflow_dispatch:
    inputs:
      tag:
        description: "Release tag"
        required: true
  release:
    types:
      - created

jobs:
  build_wheels:
    uses: dottxt-ai/outlines-core/.github/workflows/build_wheels.yml@main
    with:
      auto_bump: true

  release:
    needs: build_wheels
    name: Publish PyPI and crates.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist

      - uses: actions/download-artifact@v4
        with:
          name: sdist
          path: dist

      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable

      - uses: Swatinem/rust-cache@v2

      - name: Bump version in Cargo.toml
        uses: ./.github/actions/bump_version

      - name: Dry-run publish to crates.io
        run: cargo publish --dry-run --allow-dirty

      - name: Print directory information
        run: |
          pwd
          ls -la
          ls -la dist

      - name: Publish to PyPI
        uses: PyO3/maturin-action@v1
        env:
          MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_SECRET}}
        with:
          command: upload
          args: --non-interactive --skip-existing dist/*

      - name: Publish to crates.io
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        # We need --allow-dirty since we dynamically change the version in Cargo.toml
        run: cargo publish --allow-dirty