chore(pyproject.toml): 更新版本号从0.1.5到0.1.6 #20
This file contains hidden or 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: Test and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' # 打标签时触发完整流程 | |
| pull_request: | |
| branches: | |
| - main # 提 PR 时自动跑测试 | |
| jobs: | |
| test: | |
| name: Run Tests on Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # 既然我们明确只支持 3.10+,就在所有支持的版本上都跑一遍 | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Run tests | |
| # uv 会自动解析 pyproject.toml 中的依赖并在隔离环境中运行 pytest | |
| run: uv run pytest tests/ | |
| build-n-publish: | |
| name: Build and publish to PyPI | |
| needs: test # 核心卡点:必须等 test 跑完且全绿,才能执行发布 | |
| if: startsWith(github.ref, 'refs/tags/v') # 仅在推送 v 开头的 tag 时才执行发布 | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/nonone | |
| permissions: | |
| id-token: write | |
| contents: read # 检出代码需要的权限 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Build distribution | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |