Skip to content

Commit

Permalink
chore: add workflow to publish to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
DoodleBears committed Jun 28, 2024
1 parent 349e1d2 commit 9822812
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Python Package

on:
push:
tags:
- "v*" # 仅在推送标签时触发

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9" # 选择 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 package to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*

- name: Clean up dist folder
run: rm -rf dist

0 comments on commit 9822812

Please sign in to comment.