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 : macos-latest
21+ python : " 3.9"
22+ - os : macos-latest
23+ python : " 3.8"
24+ - os : macos-latest
25+ python : " 3.7"
26+ - os : ubuntu-latest
27+ python : " 3.7"
28+
29+ steps :
30+ - uses : actions/checkout@v4
31+
32+ # - uses: actions/setup-python@v5
33+ # with:
34+ # python-version: ${{ matrix.python }}
35+
36+ - name : Install Git Bash on Windows (only if Python 3.14)
37+ if : ${{ matrix.python == '3.14' && runner.os == 'Windows' }}
38+ run : |
39+ choco install git
40+ echo "Git Bash installed."
41+
42+ - name : Install Python 3.14 with pyenv (if needed)
43+ if : ${{ matrix.python == '3.14' }}
44+ run : |
45+ curl https://pyenv.run | bash
46+ export PATH="$HOME/.pyenv/bin:$PATH"
47+ eval "$(pyenv init --path)"
48+ eval "$(pyenv init -)"
49+ pyenv install 3.14-dev
50+ pyenv global 3.14-dev
51+
52+ - name : Setup Python
53+ if : ${{ matrix.python != '3.14' }}
54+ uses : actions/setup-python@v5
55+ with :
56+ python-version : ${{ matrix.python }}
57+
58+ - name : Install build tools
59+ run : pip install build twine wheel
60+
61+ - name : Build wheel
62+ run : python -m build --wheel
63+
64+ - name : Upload built packages
65+ uses : actions/upload-artifact@v4
66+ with :
67+ name : pkg-${{ matrix.os }}-${{ matrix.python }}-${{ strategy.job-index }}
68+ path : |
69+ ./dist/*.whl
70+
71+ build-sdist :
972 runs-on : ubuntu-latest
1073
1174 steps :
12- - name : Checkout code
13- uses : actions/checkout@v4
75+ - uses : actions/checkout@v4
1476
1577 - uses : actions/setup-python@v5
1678 with :
@@ -19,11 +81,35 @@ jobs:
1981 - name : Install build tools
2082 run : pip install build twine wheel
2183
22- - name : Build package
23- run : python -m build
84+ - name : Build source distribution
85+ run : python -m build --sdist
86+
87+ - name : Upload built packages
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : pkg-sdist
91+ path : |
92+ ./dist/*.tar.gz
93+
94+ publish :
95+ needs : [build-whl, build-sdist]
96+ runs-on : ubuntu-latest
97+
98+ environment :
99+ name : release
100+ url : https://pypi.org/project/flask-inputfilter
101+
102+ permissions :
103+ id-token : write
104+
105+ steps :
106+ - name : Download built packages
107+ uses : actions/download-artifact@v4
108+ with :
109+ path : dist
110+ merge-multiple : true
24111
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
112+ - name : Publish package to PyPI
113+ # uses: pypa/gh-action-pypi-publish@release/v1
114+ run : |
115+ ls -la dist
0 commit comments