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