Skip to content

release: temporarily drop x86_64-apple-darwin (Intel-Mac) from the wh… #266

release: temporarily drop x86_64-apple-darwin (Intel-Mac) from the wh…

release: temporarily drop x86_64-apple-darwin (Intel-Mac) from the wh… #266

Workflow file for this run

name: Release
# Builds per-platform wheels with maturin and publishes them:
# * SLIM wheels (no lingua-rs models, ~2 MB) + sdist -> PyPI
# * FULL wheels (embedded language-detection models, ~140 MB) -> GitHub Release
# Triggered by pushing a version tag, e.g. `v1.0.10`.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Version to build (without leading v), e.g. 1.0.10"
required: true
permissions:
contents: write # create the GitHub Release + upload assets
jobs:
# ---------------------------------------------------------------------------
version:
name: Resolve version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- id: v
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
fi
# ---------------------------------------------------------------------------
build:
name: ${{ matrix.variant }} · ${{ matrix.platform.target }}
needs: version
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
variant: [slim, full]
platform:
- { os: macos-14, target: aarch64-apple-darwin }
# x86_64-apple-darwin (Intel, macos-13) temporarily disabled: GitHub's
# macos-13 runner queue was starving releases and blocking publish for
# every platform. Intel-Mac users build from the sdist meanwhile.
# - { os: macos-13, target: x86_64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, manylinux: auto }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, manylinux: auto }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
steps:
- uses: actions/checkout@v4
- name: Set version in pyproject
shell: bash
run: |
python - <<'PY'
import re, pathlib
p = pathlib.Path("pyproject.toml"); s = p.read_text()
s = re.sub(r'(?m)^version = ".*"$',
'version = "${{ needs.version.outputs.version }}"', s, count=1)
p.write_text(s)
PY
- name: Build wheel (${{ matrix.variant }})
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
manylinux: ${{ matrix.platform.manylinux || '' }}
args: >-
--release
--out dist
${{ matrix.variant == 'slim' && '--no-default-features' || '' }}
sccache: "true"
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.variant }}-${{ matrix.platform.target }}
path: dist/*.whl
# ---------------------------------------------------------------------------
sdist:
name: Source distribution
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set version in pyproject
run: |
python - <<'PY'
import re, pathlib
p = pathlib.Path("pyproject.toml"); s = p.read_text()
s = re.sub(r'(?m)^version = ".*"$',
'version = "${{ needs.version.outputs.version }}"', s, count=1)
p.write_text(s)
PY
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# ---------------------------------------------------------------------------
publish-pypi:
name: Publish slim wheels + sdist to PyPI
needs: [build, sdist]
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-slim-*
path: dist
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
skip-existing: true
password: ${{ secrets.PYPI_API_TOKEN }}
# ---------------------------------------------------------------------------
github-release:
name: Attach all wheels to the GitHub Release
needs: [build, sdist]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create/Update GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.whl
dist/*.tar.gz
generate_release_notes: true
body: |
Automated release built by maturin.
* **PyPI** carries the slim wheels (~2 MB, no bundled
language-detection models) plus the source distribution.
* The **full wheels** attached here embed the lingua-rs models
(~140 MB) so `num2words_sentence(lang=None)` auto-detects
natively. Install one with `pip install <asset-url>`.