2024-11-02 13:53:25 +08:00
|
|
|
name: Publish to PyPI on main branch update
|
2024-11-01 19:18:29 +08:00
|
|
|
on:
|
2024-11-02 13:53:25 +08:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-11-01 19:18:29 +08:00
|
|
|
|
|
|
|
jobs:
|
2024-11-02 13:53:25 +08:00
|
|
|
build_and_publish:
|
2024-11-01 19:24:47 +08:00
|
|
|
runs-on: ubuntu-latest
|
2024-11-01 19:18:29 +08:00
|
|
|
steps:
|
2024-11-02 13:53:25 +08:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.11' # 指定你需要的Python版本
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install setuptools wheel twine
|
|
|
|
|
|
|
|
- name: Build package
|
|
|
|
run: python setup.py sdist bdist_wheel
|
|
|
|
|
|
|
|
- name: Publish to PyPI
|
|
|
|
run: |
|
|
|
|
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
|