Skip to content

Commit 9822812

Browse files
committed
chore: add workflow to publish to pypi
1 parent 349e1d2 commit 9822812

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # 仅在推送标签时触发
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: "3.9" # 选择 Python 版本
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install setuptools wheel twine
25+
26+
- name: Build package
27+
run: python setup.py sdist bdist_wheel
28+
29+
- name: Publish package to PyPI
30+
env:
31+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
32+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
33+
run: twine upload dist/*
34+
35+
- name: Clean up dist folder
36+
run: rm -rf dist

0 commit comments

Comments
 (0)