Skip to content

Commit 7439a4b

Browse files
authored
Update publish-release.yml with multiple Python versions (#11)
1 parent eeb49db commit 7439a4b

File tree

1 file changed

+100
-9
lines changed

1 file changed

+100
-9
lines changed

.github/workflows/publish-release.yml

+100-9
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,114 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
deploy:
13-
12+
compile-and-deploy:
1413
runs-on: ubuntu-latest
15-
16-
steps:
17-
- uses: actions/checkout@v4
14+
strategy:
15+
matrix:
16+
include:
17+
- matlab: "R2020b"
18+
python: "2.7"
19+
20+
- matlab: "R2020b"
21+
python: "3.8"
22+
py3from: "3.6"
23+
py3to: "3.9"
24+
25+
- matlab: "R2021a"
26+
python: "2.7"
27+
28+
- matlab: "R2021a"
29+
python: "3.8"
30+
py3from: "3.7"
31+
py3to: "3.9"
32+
33+
- matlab: "R2021b"
34+
python: "2.7"
35+
36+
- matlab: "R2021b"
37+
python: "3.9"
38+
py3from: "3.7"
39+
py3to: "3.10"
40+
41+
- matlab: "R2022a"
42+
python: "2.7"
43+
44+
- matlab: "R2022a"
45+
python: "3.9"
46+
py3from: "3.8"
47+
py3to: "3.10"
48+
49+
- matlab: "R2022b"
50+
python: "2.7"
51+
52+
- matlab: "R2022b"
53+
python: "3.10"
54+
py3from: "3.8"
55+
py3to: "3.11"
56+
57+
- matlab: "R2023a"
58+
python: "3.10"
59+
py3from: "3.8"
60+
py3to: "3.11"
61+
62+
- matlab: "R2023b"
63+
python: "3.11"
64+
py3from: "3.9"
65+
py3to: "3.12"
66+
67+
- matlab: "R2024a"
68+
python: "3.11"
69+
py3from: "3.9"
70+
py3to: "3.12"
71+
72+
- matlab: "R2024b"
73+
python: "3.12"
74+
py3from: "3.9"
75+
py3to: "3.13"
76+
77+
- matlab: "R2024b"
78+
main: "true"
79+
python: "3.12"
80+
py3from: "3.9"
81+
py3to: "3.13"
82+
83+
steps:
84+
- uses: spm/spm-python/.github/workflows/compile_spm.yml@main
85+
with:
86+
matlab-version: ${{ matrix.matlab }}
1887

1988
- name: Set up Python
2089
uses: actions/setup-python@v5
2190
with:
22-
python-version: "3.12"
23-
91+
python-version: ${{ matrix.python }}
92+
2493
- name: Install dependencies
2594
run: |
2695
python -m pip install --upgrade pip
2796
pip install build
28-
pip install numpy scipy
29-
97+
pip install numpy
98+
99+
- name: Add Matlab version specifier
100+
if: ${{ matrix.main != "true" }}
101+
run: |
102+
sed -i 's/\(version = "[^"]*\)"/\1+${{ matrix.matlab }}"/' pyproject.toml
103+
cat pyproject.toml
104+
105+
- name: Setup Python version (2.7)
106+
if: matrix.python == "2.7"
107+
run: |
108+
sed -i 's/^python-requires = .*/python-requires = ">=2.7,<3.1"/' pyproject.toml
109+
echo "[tool.distutils.bdist_wheel]" >> pyproject.toml
110+
echo "python-tag = \"2.7\"" >> pyproject.toml
111+
112+
- name: Setup Python version (3+)
113+
if: ${{ matrix.py3from }}
114+
run: |
115+
sed -i 's/^python-requires = .*/python-requires = ">=${{ matrix.py3from }},<${{ matrix.py3to }}"/' pyproject.toml
116+
tags=$(for i in $(seq ${${{ matrix.py3from }}//./} $(( ${${{ matrix.py3to }}//./} - 1)) ); do echo -n "py$i."; done | sed 's/\.$//')
117+
echo "[tool.distutils.bdist_wheel]" >> pyproject.toml
118+
echo "python-tag = \"$tags\"" >> pyproject.toml
119+
30120
- name: Build package
31121
run: python -m build
32122

@@ -35,3 +125,4 @@ jobs:
35125
with:
36126
user: __token__
37127
password: ${{ secrets.PYPI_API_TOKEN }}
128+

0 commit comments

Comments
 (0)