💚 ci(.pre-commit-config.yaml): 调整 black 钩子到 pre-commit 阶段 #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish package to PyPI | |
on: | |
push: | |
tags: | |
- 'v*' # 匹配"v1.0.0"、"v1.0.0-alpha"等发布标签 | |
permissions: | |
contents: write # 如果您的包发布到 GitHub Packages,则需要此权限 | |
packages: write # 如果您的包发布到 GitHub Packages,则需要此权限 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 # 使用一个稳定的版本标签,而不是具体的提交哈希 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |