|
8 | 8 | runs-on: ubuntu-latest |
9 | 9 | strategy: |
10 | 10 | max-parallel: 4 |
11 | | - matrix: |
12 | | - python-version: [3.11, 3.12] |
13 | 11 |
|
14 | 12 | steps: |
15 | | - - uses: actions/checkout@v4 |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - uses: astral-sh/setup-uv@v3 |
| 15 | + with: |
| 16 | + python-version: 3.13 |
| 17 | + enable-cache: true |
| 18 | + cache-dependency-glob: "uv.lock" |
| 19 | + - run: uv sync --all-extras --dev |
| 20 | + - uses: astral-sh/ruff-action@v3 |
| 21 | + - run: uv run mypy . |
| 22 | + - run: uv run pytest |
| 23 | + - uses: codecov/codecov-action@v4 |
| 24 | + with: |
| 25 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 26 | + - if: ${{ !cancelled() }} |
| 27 | + uses: codecov/test-results-action@v1 |
| 28 | + with: |
| 29 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 30 | + - uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: python-package-distributions |
| 33 | + path: dist/ |
16 | 34 |
|
17 | | - - uses: astral-sh/setup-uv@v3 |
18 | | - with: |
19 | | - python-version: ${{ matrix.python-version }} |
20 | | - enable-cache: true |
21 | | - cache-dependency-glob: "uv.lock" |
| 35 | + publish-to-testpypi: |
| 36 | + name: Publish Python 🐍 distribution 📦 to TestPyPI |
| 37 | + needs: |
| 38 | + - build |
| 39 | + runs-on: ubuntu-latest |
22 | 40 |
|
23 | | - - run: uv sync --all-extras --dev |
| 41 | + environment: |
| 42 | + name: testpypi |
| 43 | + url: https://test.pypi.org/p/sprog |
24 | 44 |
|
25 | | - - uses: astral-sh/ruff-action@v3 |
| 45 | + permissions: |
| 46 | + id-token: write |
26 | 47 |
|
27 | | - - run: uv run mypy . |
| 48 | + steps: |
| 49 | + - name: actions/download-artifact@v4 |
| 50 | + with: |
| 51 | + name: python-package-distributions |
| 52 | + path: dist/ |
| 53 | + - name: pypa/gh-action-pypi-publish@release/v1 |
| 54 | + with: |
| 55 | + repository-url: https://test.pypi.org/legacy/ |
28 | 56 |
|
29 | | - - run: uv run pytest |
| 57 | + publish-to-pypi: |
| 58 | + name: Publish Python 🐍 distribution 📦 to PyPI |
| 59 | + if: startsWith(github.ref, 'refs/tags/') |
| 60 | + needs: |
| 61 | + - build |
| 62 | + runs-on: ubuntu-latest |
30 | 63 |
|
31 | | - - uses: codecov/codecov-action@v4 |
32 | | - with: |
33 | | - token: ${{ secrets.CODECOV_TOKEN }} |
| 64 | + environment: |
| 65 | + name: pypi |
| 66 | + url: https://pypi.org/p/sprog |
34 | 67 |
|
35 | | - - if: ${{ !cancelled() }} |
36 | | - uses: codecov/test-results-action@v1 |
37 | | - with: |
38 | | - token: ${{ secrets.CODECOV_TOKEN }} |
| 68 | + permissions: |
| 69 | + id-token: write |
| 70 | + |
| 71 | + steps: |
| 72 | + - name: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: python-package-distributions |
| 75 | + path: dist/ |
| 76 | + - name: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments