clincalc 0.2.2

Open, auditable clinical calculators: a pure scoring engine plus the `clincalc` CLI in one crate. The engine is a serde-only leaf (build with default-features = false); the default `cli` feature adds the `clincalc` binary.
Documentation
# SPDX-FileCopyrightText: 2026 Marcus Baw and Baw Medical Ltd
# SPDX-License-Identifier: AGPL-3.0-or-later

name: Publish Python package to PyPI

# Builds and publishes the `clincalc` Python wheel/sdist for the tag. Invoked
# by auto-tag.yml via workflow_call (the cascade); also triggerable manually
# or by a `v*` tag push to re-publish a given tag.
#
# Publishes with PyPI Trusted Publishing via GitHub OIDC. PyPI must trust this
# repository and workflow; no long-lived API token is stored in GitHub.

on:
  workflow_call:
    inputs:
      tag:
        description: "Tag to publish, e.g. v0.1.0"
        required: true
        type: string
  workflow_dispatch:
    inputs:
      tag:
        description: "Tag to publish, e.g. v0.2.0"
        required: true
        type: string
  push:
    tags:
      - "v*"

permissions:
  contents: read

jobs:
  linux:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target: [x86_64, aarch64]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          ref: ${{ inputs.tag || github.ref }}
      - uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
        with:
          command: build
          args: --release --locked --target ${{ matrix.target }}-unknown-linux-gnu --out dist --manifest-path Cargo.toml
          manylinux: auto
          working-directory: python
      - name: Upload wheels
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: wheels-linux-${{ matrix.target }}
          path: python/dist

  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        target: [x64]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          ref: ${{ inputs.tag || github.ref }}
      - uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
        with:
          command: build
          args: --release --locked --target ${{ matrix.target }}-pc-windows-msvc --out dist --manifest-path Cargo.toml
          working-directory: python
      - name: Upload wheels
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: wheels-windows-${{ matrix.target }}
          path: python/dist

  macos:
    runs-on: macos-latest
    strategy:
      matrix:
        target: [x86_64, aarch64]
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          ref: ${{ inputs.tag || github.ref }}
      - uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
        with:
          command: build
          args: --release --locked --target ${{ matrix.target }}-apple-darwin --out dist --manifest-path Cargo.toml
          working-directory: python
      - name: Upload wheels
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: wheels-macos-${{ matrix.target }}
          path: python/dist

  sdist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          ref: ${{ inputs.tag || github.ref }}
      - uses: PyO3/maturin-action@3e2bdf6ba6453a61e649744019b8a2d906c7eb38 # v1.51.0
        with:
          command: sdist
          args: --out dist --manifest-path Cargo.toml
          working-directory: python
      - name: Upload sdist
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: sdist
          path: python/dist

  release:
    name: Release
    runs-on: ubuntu-latest
    needs: [linux, windows, macos, sdist]
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          path: dist
          pattern: wheels-*
          merge-multiple: true
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          path: dist
          pattern: sdist
          merge-multiple: true
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@6733eb7d741f0b11ec6a39b58540dab7590f9b7d # v1.14.0
        with:
          packages-dir: dist