22
22
strategy :
23
23
fail-fast : False
24
24
matrix :
25
- python-version : ['3.8', '3.9', '3.10', '3.11', '3.12']
25
+ python-version : [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
26
26
steps :
27
27
- name : Checkout repository
28
28
uses : actions/checkout@v4
91
91
strategy :
92
92
matrix :
93
93
os : [ windows-latest, ubuntu-latest, macos-latest ]
94
- python-version : ['3.8', '3.9', '3.10', '3.11', '3.12']
94
+ python-version : [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
95
95
96
96
steps :
97
97
- name : Checkout repository
@@ -136,8 +136,8 @@ jobs:
136
136
pip install ${file}
137
137
python extern/nlopt/test/t_python.py
138
138
139
- deploy-test :
140
- name : Deploy packages to TestPyPI
139
+ deploy :
140
+ name : Deploy packages
141
141
runs-on : ubuntu-latest
142
142
needs : test-wheels
143
143
if : ${{ !startsWith(github.ref, 'refs/tags/') }}
@@ -156,38 +156,32 @@ jobs:
156
156
- name : Install twine
157
157
run : pip install twine
158
158
159
- - name : List directory
159
+ - name : Move files to top level directory
160
160
run : |
161
- ls -ltR
161
+ ls -ltR dist
162
+ python - << EOF
163
+ from pathlib import Path
164
+ import shutil
165
+
166
+ d = Path('dist')
167
+ for f in d.rglob('*.whl'):
168
+ shutil.move(f, d / f.name)
169
+
170
+ for f in d.iterdir():
171
+ if f.is_dir():
172
+ shutil.rmtree(f)
173
+
174
+ EOF
162
175
163
176
- name : Upload packages to testpypi
177
+ if : ${{ !startsWith(github.ref, 'refs/tags/') }}
164
178
env :
165
179
TWINE_USERNAME : ${{ secrets.PYPI_TEST_TOKEN_NAME }}
166
180
TWINE_PASSWORD : ${{ secrets.PYPI_TEST_API_TOKEN }}
167
181
run : python -m twine upload --skip-existing --repository testpypi dist/* --verbose
168
182
169
- deploy :
170
- name : Deploy packages to PyPI
171
- runs-on : ubuntu-latest
172
- needs : test-wheels
173
- if : startsWith(github.ref, 'refs/tags/')
174
-
175
- steps :
176
- - name : Setup Python ${{ matrix.python-version }}
177
- uses : actions/setup-python@v4
178
- with :
179
- python-version : ${{ matrix.python-version }}
180
-
181
- - name : Retrieve packages
182
- uses : actions/download-artifact@v4
183
- with :
184
- name : artifact
185
- path : dist
186
-
187
- - name : Install twine
188
- run : pip install twine
189
-
190
183
- name : Upload packages to pypi
184
+ if : startsWith(github.ref, 'refs/tags/')
191
185
env :
192
186
TWINE_USERNAME : ${{ secrets.PYPI_PROD_TOKEN_NAME }}
193
187
TWINE_PASSWORD : ${{ secrets.PYPI_PROD_API_TOKEN }}
0 commit comments