Skip to content

Commit aed18f1

Browse files
committed
Publish package distribution releases
1 parent 54c4307 commit aed18f1

File tree

1 file changed

+57
-19
lines changed

1 file changed

+57
-19
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,69 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
max-parallel: 4
11-
matrix:
12-
python-version: [3.11, 3.12]
1311

1412
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/
1634

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
2240

23-
- run: uv sync --all-extras --dev
41+
environment:
42+
name: testpypi
43+
url: https://test.pypi.org/p/sprog
2444

25-
- uses: astral-sh/ruff-action@v3
45+
permissions:
46+
id-token: write
2647

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/
2856

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
3063

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
3467

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

Comments
 (0)