Skip to content

Commit 4e45db4

Browse files
committed
ci(github-actions): 移除重复的发布工作流并优化安装验证脚本
移除了 `.github/workflows/build-wheels.yml` 中冗余的 publish 任务,该任务与 `.github/workflows/publish.yml` 功能重叠。同时优化了发布后验证逻辑:统一版本号提取方式,去除 `v` 前缀;调整 Python 包验证命令以提高兼容性;新增 GitPython 依赖安装步骤以支持后续自动化操作。
1 parent 32ee71a commit 4e45db4

File tree

2 files changed

+16
-53
lines changed

2 files changed

+16
-53
lines changed

.github/workflows/build-wheels.yml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -137,47 +137,3 @@ jobs:
137137
print('AkShare not available (expected on some platforms)')
138138
"
139139
140-
publish:
141-
if: github.event_name == 'release'
142-
needs: [build, test-install]
143-
runs-on: ubuntu-latest
144-
145-
steps:
146-
- uses: actions/checkout@v4
147-
148-
- name: Set up Python
149-
uses: actions/setup-python@v5
150-
with:
151-
python-version: '3.12'
152-
153-
- name: Install build dependencies
154-
run: |
155-
python -m pip install --upgrade pip
156-
pip install build wheel setuptools twine
157-
pip install poetry
158-
159-
- name: Install system dependencies
160-
run: |
161-
sudo apt-get update
162-
sudo apt-get install -y libhdf5-dev
163-
164-
# 从源码编译安装ta-lib
165-
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
166-
tar -xzf ta-lib-0.4.0-src.tar.gz
167-
cd ta-lib/
168-
./configure --prefix=/usr
169-
make
170-
sudo make install
171-
cd ..
172-
rm -rf ta-lib ta-lib-0.4.0-src.tar.gz
173-
174-
- name: Build distribution
175-
run: |
176-
poetry build
177-
178-
- name: Publish to PyPI
179-
env:
180-
TWINE_USERNAME: __token__
181-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
182-
run: |
183-
twine upload dist/*

.github/workflows/publish.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,19 @@ jobs:
110110
# 等待PyPI索引更新
111111
sleep 30
112112
113+
# 获取不带v前缀的版本号
114+
VERSION=${{ github.event.release.tag_name }}
115+
VERSION=${VERSION#v}
116+
113117
# 尝试安装刚发布的包
114-
pip install simtradelab==${{ github.event.release.tag_name }}
118+
pip install simtradelab==$VERSION
115119
116120
# 验证安装
117-
python -c "
118-
import simtradelab
119-
from simtradelab.backtest.runner import BacktestRunner
120-
print(f'✅ SimTradeLab {simtradelab.__version__} installed successfully')
121-
"
121+
python -c 'import simtradelab; from simtradelab.backtest.runner import BacktestRunner; print("✅ SimTradeLab " + simtradelab.__version__ + " installed successfully")'
122+
123+
- name: Install script dependencies
124+
run: |
125+
pip install gitpython
122126
123127
- name: Generate Release Notes
124128
id: release_notes
@@ -150,18 +154,21 @@ jobs:
150154
uses: actions/github-script@v7
151155
with:
152156
script: |
157+
const tagName = '${{ github.event.release.tag_name }}';
158+
const version = tagName.replace(/^v/, '');
159+
153160
github.rest.issues.createComment({
154161
issue_number: context.payload.release.id,
155162
owner: context.repo.owner,
156163
repo: context.repo.repo,
157-
body: `🎉 SimTradeLab ${{ github.event.release.tag_name }} has been successfully published to PyPI!
164+
body: `🎉 SimTradeLab ${tagName} has been successfully published to PyPI!
158165
159166
📦 **Installation:**
160167
\`\`\`bash
161-
pip install simtradelab==${{ github.event.release.tag_name }}
168+
pip install simtradelab==${version}
162169
\`\`\`
163170
164-
🔗 **PyPI Link:** https://pypi.org/project/simtradelab/${{ github.event.release.tag_name }}/
171+
🔗 **PyPI Link:** https://pypi.org/project/simtradelab/${version}/
165172
166173
✅ **Verification:** Package installation verified successfully.
167174

0 commit comments

Comments
 (0)