Skip to content

Use reusable build workflow #3

Use reusable build workflow

Use reusable build workflow #3

Workflow file for this run

name: Build and Attach Release Packages
on:
push:
tags:
- 'v*' # 当推送标签(如 v0.1.0、v2.0.3)时触发
workflow_dispatch: # 也可以手动触发
permissions:
contents: write # ✅ 关键:允许 Actions 创建和更新 release
jobs:
build:
name: Build Python package on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies
run: |
pip install -q build setuptools wheel pybind11 cmake ninja scikit-build-core
- name: Build the package
run: |
python -m build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*
- name: Upload release assets
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}