llm-engine-rs 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: Build and Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
# 只有打 tag 时才发布到 PyPI 和 GitHub Release
|
|
8
|
+
# 触发命令例如:git tag v0.1.0 && git push origin v0.1.0
|
|
9
|
+
tags:
|
|
10
|
+
- 'v*'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
# 1. 在各个平台构建二进制包 (Wheels)
|
|
14
|
+
build-wheels:
|
|
15
|
+
name: Build wheels on ${{ matrix.os }}
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Build wheels
|
|
24
|
+
uses: PyO3/maturin-action@v1
|
|
25
|
+
with:
|
|
26
|
+
command: build
|
|
27
|
+
args: --release --out dist
|
|
28
|
+
manylinux: auto
|
|
29
|
+
|
|
30
|
+
- name: Upload wheels
|
|
31
|
+
uses: actions/upload-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: wheels-${{ matrix.os }}
|
|
34
|
+
path: dist/*.whl
|
|
35
|
+
|
|
36
|
+
# 2. 构建源码包 (Source Distribution)
|
|
37
|
+
build-sdist:
|
|
38
|
+
name: Build source distribution
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Build sdist
|
|
44
|
+
uses: PyO3/maturin-action@v1
|
|
45
|
+
with:
|
|
46
|
+
command: sdist
|
|
47
|
+
args: --out dist
|
|
48
|
+
|
|
49
|
+
- name: Upload sdist
|
|
50
|
+
uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: wheels-sdist
|
|
53
|
+
path: dist/*.tar.gz
|
|
54
|
+
|
|
55
|
+
# 3. 发布到 PyPI 和 GitHub Release (仅在打 tag 时执行)
|
|
56
|
+
release:
|
|
57
|
+
name: Release to PyPI and GitHub
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
# 需要等待 wheels 和 sdist 都构建成功
|
|
60
|
+
needs: [build-wheels, build-sdist]
|
|
61
|
+
# 仅当触发事件是 tag,且 tag 名称以 v 开头时执行
|
|
62
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
# 下载前面步骤产生的所有包 (v4 的 merge-multiple 会把它们放进同一个 dist 目录)
|
|
66
|
+
- name: Download all artifacts
|
|
67
|
+
uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
pattern: wheels-*
|
|
70
|
+
merge-multiple: true
|
|
71
|
+
path: dist
|
|
72
|
+
|
|
73
|
+
# 发布到 PyPI
|
|
74
|
+
- name: Publish to PyPI
|
|
75
|
+
uses: PyO3/maturin-action@v1
|
|
76
|
+
with:
|
|
77
|
+
command: upload
|
|
78
|
+
args: --skip-existing dist/*
|
|
79
|
+
env:
|
|
80
|
+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
81
|
+
|
|
82
|
+
# (可选) 自动在 GitHub 上创建一个 Release
|
|
83
|
+
- name: Create GitHub Release
|
|
84
|
+
uses: softprops/action-gh-release@v2
|
|
85
|
+
with:
|
|
86
|
+
files: dist/*
|
|
87
|
+
generate_release_notes: true
|