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.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
19+ exclude :
20+ - os : windows-latest
21+ python : " 3.14"
22+ - os : macos-latest
23+ python : " 3.7"
24+ - os : ubuntu-latest
25+ python : " 3.7"
26+
27+ steps :
28+ - uses : actions/checkout@v4
29+
30+ - name : Install Python 3.14 with pyenv (if needed)
31+ if : ${{ matrix.python == '3.14' }}
32+ run : |
33+ curl https://pyenv.run | bash
34+ export PATH="$HOME/.pyenv/bin:$PATH"
35+ eval "$(pyenv init --path)"
36+ eval "$(pyenv init -)"
37+ pyenv install 3.14-dev
38+ pyenv global 3.14-dev
39+
40+ - name : Setup Python
41+ if : ${{ matrix.python != '3.14' }}
42+ uses : actions/setup-python@v5
43+ with :
44+ python-version : ${{ matrix.python }}
45+
46+ - name : Install build tools
47+ run : pip install build twine wheel
48+
49+ - name : Build wheel
50+ run : python -m build --wheel
51+
52+ - name : Upload built packages
53+ uses : actions/upload-artifact@v4
54+ with :
55+ name : pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
56+ path : |
57+ ./dist/*.whl
58+
59+ build-sdist :
960 runs-on : ubuntu-latest
1061
1162 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
63+ - uses : actions/checkout@v4
1464
1565 - uses : actions/setup-python@v5
1666 with :
@@ -19,11 +69,35 @@ jobs:
1969 - name : Install build tools
2070 run : pip install build twine wheel
2171
22- - name : Build package
23- run : python -m build
72+ - name : Build source distribution
73+ run : python -m build --sdist
74+
75+ - name : Upload built packages
76+ uses : actions/upload-artifact@v4
77+ with :
78+ name : pkg-sdist
79+ path : |
80+ ./dist/*.tar.gz
81+
82+ publish :
83+ needs : [build-whl, build-sdist]
84+ runs-on : ubuntu-latest
85+
86+ environment :
87+ name : release
88+ url : https://pypi.org/project/flask-inputfilter
89+
90+ permissions :
91+ id-token : write
92+
93+ steps :
94+ - name : Download built packages
95+ uses : actions/download-artifact@v4
96+ with :
97+ path : dist
98+ merge-multiple : true
2499
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
100+ - name : Publish package to PyPI
101+ # uses: pypa/gh-action-pypi-publish@release/v1
102+ run : |
103+ ls -la dist
0 commit comments