5ca413ebbf
* Fix release workflow: Python compatibility issues - Linux: Add --find-interpreter for cross-compilation - macOS/Windows: Pin Python to 3.12 (PyO3 0.20.3 max supported) * Fix Linux release: limit Python versions to 3.10-3.12 PyO3 0.20.3 only supports up to Python 3.12. Using --find-interpreter detected Python 3.13/3.14 in the manylinux container which caused build failures.
133 lines
3.0 KiB
YAML
133 lines
3.0 KiB
YAML
name: Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
publish:
|
|
description: 'Publish to PyPI'
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# Build wheels for Linux
|
|
linux:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
target: [x86_64, aarch64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build wheels
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
args: --release --out dist -i python3.10 -i python3.11 -i python3.12
|
|
manylinux: auto
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-linux-${{ matrix.target }}
|
|
path: dist
|
|
|
|
# Build wheels for macOS
|
|
macos:
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
target: [x86_64, aarch64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Build wheels
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.target }}-apple-darwin
|
|
args: --release --out dist
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-macos-${{ matrix.target }}
|
|
path: dist
|
|
|
|
# Build wheels for Windows
|
|
windows:
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
target: [x64]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Build wheels
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
args: --release --out dist
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-windows-${{ matrix.target }}
|
|
path: dist
|
|
|
|
# Build source distribution
|
|
sdist:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build sdist
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
command: sdist
|
|
args: --out dist
|
|
|
|
- name: Upload sdist
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: wheels-sdist
|
|
path: dist
|
|
|
|
# Publish to PyPI
|
|
publish:
|
|
name: Publish to PyPI
|
|
runs-on: ubuntu-latest
|
|
needs: [linux, macos, windows, sdist]
|
|
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish)
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/raptorbt
|
|
permissions:
|
|
id-token: write # Required for trusted publishing
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: wheels-*
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: List dist contents
|
|
run: ls -la dist/
|
|
|
|
- name: Publish to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|