Skip to content

v0.1.2

v0.1.2 #9

Workflow file for this run

# Publish Python Package to PyPI
# Triggered on release publish or manual dispatch
name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
# ============================================
# Build Linux x86-64 wheels (使用 just 命令)
# ============================================
linux-x86-64:
name: Build Linux x86-64 wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build wheel in manylinux container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_x86_64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-x86-64
path: dist
# ============================================
# Build Linux aarch64 wheels (使用 QEMU 仿真原生构建)
# ============================================
linux-aarch64:
name: Build Linux aarch64 wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build wheel in QEMU
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace -w /workspace \
quay.io/pypa/manylinux2014_aarch64 \
bash -c "
curl -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin && \
just ci-setup-manylinux && \
just ci-build manylinux=true
"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64
path: dist
# ============================================
# Build macOS wheels (arm64 + x86_64)
# ============================================
macos:
name: Build macOS wheels
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.10'
- name: Build wheels (arm64)
uses: PyO3/maturin-action@v1
with:
target: aarch64-apple-darwin
args: --release --out dist
sccache: 'true'
- name: Build wheels (x86_64)
uses: PyO3/maturin-action@v1
with:
target: x86_64-apple-darwin
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: dist
# ============================================
# Build Windows wheels
# ============================================
windows:
name: Build Windows wheels
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows
path: dist
# ============================================
# Build source distribution
# ============================================
sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.10'
- 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-x86-64, linux-aarch64, macos, windows, sdist]
environment:
name: pypi
url: https://pypi.org/project/pulsing/
permissions:
id-token: write # For trusted publishing
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: List distribution files
run: ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# 使用 Trusted Publishing (推荐) 或 API Token
# 如果使用 API Token,取消下面两行的注释
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}