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-newer-whl :
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ matrix :
17+ os : [ ubuntu-latest, windows-latest, macos-latest ]
18+ python : [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
19+ exclude :
20+ - os : macos-latest
21+ python : " 3.9"
22+ - os : macos-latest
23+ python : " 3.8"
24+
25+ steps :
26+ - uses : actions/checkout@v4
27+
28+ - uses : actions/setup-python@v5
29+ with :
30+ python-version : ${{ matrix.python }}
31+
32+ - name : Install build tools
33+ run : pip install build twine wheel
34+
35+ - name : Build wheel
36+ run : python -m build --wheel
37+
38+ - name : Upload built packages
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
42+ path : |
43+ ./dist/*.whl
44+
45+ build-sdist :
946 runs-on : ubuntu-latest
1047
1148 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
49+ - uses : actions/checkout@v4
1450
1551 - uses : actions/setup-python@v5
1652 with :
@@ -19,11 +55,35 @@ jobs:
1955 - name : Install build tools
2056 run : pip install build twine wheel
2157
22- - name : Build package
23- run : python -m build
58+ - name : Build source distribution
59+ run : python -m build --sdist
60+
61+ - name : Upload built packages
62+ uses : actions/upload-artifact@v4
63+ with :
64+ name : pkg-sdist
65+ path : |
66+ ./dist/*.tar.gz
67+
68+ publish :
69+ needs : [build-older-whl, build-newer-whl, build-sdist]
70+ runs-on : ubuntu-latest
71+
72+ environment :
73+ name : release
74+ url : https://pypi.org/project/flask-inputfilter
75+
76+ permissions :
77+ id-token : write
78+
79+ steps :
80+ - name : Download built packages
81+ uses : actions/download-artifact@v4
82+ with :
83+ path : dist
84+ merge-multiple : true
2485
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
86+ - name : Publish package to PyPI
87+ # uses: pypa/gh-action-pypi-publish@release/v1
88+ run : |
89+ ls -la dist
0 commit comments