11name : Publish to PyPI
22
3- on :
4- release :
5- types : [published]
3+ on : [push]
4+ # release:
5+ # types: [published]
6+
7+ concurrency :
8+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+ cancel-in-progress : true
610
711jobs :
8- publish :
12+
13+ build-whl :
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ matrix :
17+ os : [ ubuntu-latest, windows-latest, macos-latest ]
18+ python : [ "3.10", "3.11", "3.12", "3.13" ]
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - uses : actions/setup-python@v5
24+ with :
25+ python-version : ${{ matrix.python }}
26+
27+ - name : Install build tools
28+ run : pip install build twine wheel
29+
30+ - name : Build wheel
31+ run : python -m build --wheel
32+
33+ - name : Upload built packages
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
37+ path : |
38+ ./dist/*.whl
39+
40+ build-sdist :
41+ needs : build-whl
942 runs-on : ubuntu-latest
1043
1144 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
45+ - uses : actions/checkout@v4
1446
1547 - uses : actions/setup-python@v5
1648 with :
@@ -19,11 +51,35 @@ jobs:
1951 - name : Install build tools
2052 run : pip install build twine wheel
2153
22- - name : Build package
23- run : python -m build
54+ - name : Build source distribution
55+ run : python -m build --sdist
56+
57+ - name : Upload built packages
58+ uses : actions/upload-artifact@v4
59+ with :
60+ name : pkg-sdist
61+ path : |
62+ ./dist/*.tar.gz
63+
64+ publish :
65+ needs : build-whl
66+ runs-on : ubuntu-latest
67+
68+ environment :
69+ name : release
70+ url : https://pypi.org/project/flask-inputfilter
71+
72+ permissions :
73+ id-token : write
74+
75+ steps :
76+ - name : Download built packages
77+ uses : actions/download-artifact@v4
78+ with :
79+ path : dist
80+ merge-multiple : true
2481
25- - name : Publish to PyPI
26- env :
27- TWINE_USERNAME : __token__
28- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
29- run : twine upload dist/*.tar.gz
82+ - name : Publish package to PyPI
83+ # uses: pypa/gh-action-pypi-publish@release/v1
84+ run : |
85+ ls -la dist
0 commit comments