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-older-whl :
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ matrix :
17+ os : [ ubuntu-20.04, windows-latest, macos-12 ]
18+ python : [ "3.7", "3.8", "3.9" ]
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-newer-whl :
41+ runs-on : ${{ matrix.os }}
42+ strategy :
43+ matrix :
44+ os : [ ubuntu-latest, windows-latest, macos-latest ]
45+ python : [ "3.10", "3.11", "3.12", "3.13" ]
46+
47+ steps :
48+ - uses : actions/checkout@v4
49+
50+ - uses : actions/setup-python@v5
51+ with :
52+ python-version : ${{ matrix.python }}
53+
54+ - name : Install build tools
55+ run : pip install build twine wheel
56+
57+ - name : Build wheel
58+ run : python -m build --wheel
59+
60+ - name : Upload built packages
61+ uses : actions/upload-artifact@v4
62+ with :
63+ name : pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
64+ path : |
65+ ./dist/*.whl
66+
67+ build-sdist :
968 runs-on : ubuntu-latest
1069
1170 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
71+ - uses : actions/checkout@v4
1472
1573 - uses : actions/setup-python@v5
1674 with :
@@ -19,11 +77,35 @@ jobs:
1977 - name : Install build tools
2078 run : pip install build twine wheel
2179
22- - name : Build package
23- run : python -m build
80+ - name : Build source distribution
81+ run : python -m build --sdist
82+
83+ - name : Upload built packages
84+ uses : actions/upload-artifact@v4
85+ with :
86+ name : pkg-sdist
87+ path : |
88+ ./dist/*.tar.gz
89+
90+ publish :
91+ needs : [build-older-whl, build-newer-whl, build-sdist]
92+ runs-on : ubuntu-latest
93+
94+ environment :
95+ name : release
96+ url : https://pypi.org/project/flask-inputfilter
97+
98+ permissions :
99+ id-token : write
100+
101+ steps :
102+ - name : Download built packages
103+ uses : actions/download-artifact@v4
104+ with :
105+ path : dist
106+ merge-multiple : true
24107
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
108+ - name : Publish package to PyPI
109+ # uses: pypa/gh-action-pypi-publish@release/v1
110+ run : |
111+ ls -la dist
0 commit comments