name: Publish to PyPI on main branch update on: push: branches: - main jobs: build_and_publish: runs-on: ubuntu-latest steps: - 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/*