@@ -24,22 +24,35 @@ jobs:
24
24
runs-on : ubuntu-latest
25
25
environment : release
26
26
permissions :
27
- id-token : write
27
+ id-token : write # IMPORTANT: mandatory for trusted publishing
28
28
timeout-minutes : 10
29
29
steps :
30
30
- uses : actions/checkout@v4
31
31
- name : Set up Python ${{ matrix.python-version }}
32
32
uses : actions/setup-python@v5
33
33
with :
34
- python-version : 3.9
34
+ python-version : 3.11
35
35
- name : Install pypa/build
36
36
run : |
37
37
python -m pip install --upgrade pip
38
38
python -m pip install --upgrade setuptools wheel
39
39
python -m pip install build --user
40
40
- name : Build a binary wheel and a source tarball
41
- run : |
42
- python -m build --sdist --wheel --outdir dist/
43
- - name : Publish package distributions to PyPI
44
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
45
- uses : pypa/gh-action-pypi-publish@release/v1
41
+ run : python3 -m build
42
+ - name : Store the distribution packages
43
+ if : >
44
+ github.event_name == 'push' &&
45
+ startsWith(github.ref, 'refs/tags') &&
46
+ github.base_ref == 'main' &&
47
+ github.actor == github.repository_owner
48
+ uses : actions/upload-artifact@v4
49
+ with :
50
+ name : python-package-distributions
51
+ path : dist/
52
+ - name : Publish package on Pypi
53
+ if : >
54
+ github.event_name == 'push' &&
55
+ startsWith(github.ref, 'refs/tags') &&
56
+ github.base_ref == 'main' &&
57
+ github.actor == github.repository_owner
58
+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments