|
1 | 1 | name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
2 | 2 |
|
3 |
| -on: push |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main # Adjust this to your default or deployment branch |
4 | 7 |
|
5 | 8 | jobs:
|
6 | 9 | build-n-publish:
|
7 |
| - name: Build and publish Python 🐍 distributions 📦 to PyPI |
| 10 | + name: Build, Test, and Publish |
8 | 11 | runs-on: ubuntu-latest
|
| 12 | + |
9 | 13 | steps:
|
10 |
| - - name: astral-sh/setup-uv |
11 |
| - # You may pin to the exact commit or the version. |
12 |
| - # uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb |
| 14 | + - name: Checkout Repository |
| 15 | + uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Setup UV |
13 | 18 |
|
14 | 19 | with:
|
15 |
| - # The version of uv to install e.g., `0.5.0` Defaults to the version in pyproject.toml or 'latest'. |
16 |
| - version: # optional, default is |
17 |
| - # The version of Python to set UV_PYTHON to |
18 |
| - python-version: # optional |
19 |
| - # Use uv venv to activate a venv ready to be used by later steps. |
20 |
| - activate-environment: # optional, default is false |
21 |
| - # The directory to execute all commands in and look for files such as pyproject.toml |
22 |
| - working-directory: # optional, default is ${{ github.workspace }} |
23 |
| - # Used to increase the rate limit when retrieving versions and downloading uv. |
24 |
| - github-token: # optional, default is ${{ github.token }} |
25 |
| - # # Enable uploading of the uv cache |
26 |
| - # enable-cache: # optional, default is auto |
27 |
| - # # Glob pattern to match files relative to the repository root to control the cache. |
28 |
| - # cache-dependency-glob: # optional, default is **/*requirements*.txt |
29 |
| - # **/*constraints*.txt |
30 |
| - # **/*constraints*.in |
31 |
| - # **/pyproject.toml |
32 |
| - # **/uv.lock |
33 |
| - - name: Build Project |
34 |
| - run: uv build |
35 |
| - |
36 |
| - # - uses: actions/checkout@master |
37 |
| - # - name: Set up Python 3.8 |
38 |
| - # uses: actions/setup-python@v1 |
39 |
| - # with: |
40 |
| - # python-version: 3.8 |
41 |
| - # - name: Install pypa/build |
42 |
| - # run: python -m pip install build --user |
43 |
| - # - name: Build a binary wheel and a source tarball |
44 |
| - # run: python -m build --sdist --wheel --outdir dist/ . |
45 |
| - # - name: Publish distribution 📦 to Test PyPI |
46 |
| - # uses: pypa/gh-action-pypi-publish@master |
47 |
| - # with: |
48 |
| - # password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
49 |
| - # repository_url: https://test.pypi.org/legacy/ |
50 |
| - # skip_existing: true |
51 |
| - |
| 20 | + version: latest |
| 21 | + activate-environment: true |
| 22 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + |
| 24 | + - name: Install Dependencies |
| 25 | + run: uv sync --with dev |
| 26 | + |
| 27 | + - name: Run Tests |
| 28 | + run: uv run pytest |
| 29 | + |
| 30 | + - name: Build Project |
| 31 | + run: uv build |
| 32 | + |
| 33 | + - name: Publish to TestPyPI |
| 34 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 35 | + with: |
| 36 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 37 | + repository-url: https://test.pypi.org/legacy/ |
| 38 | + skip-existing: true |
| 39 | + |
| 40 | + # Optional: Publish to PyPI (uncomment to enable) |
| 41 | + # - name: Publish to PyPI |
| 42 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 43 | + # with: |
| 44 | + # password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments