Skip to content

Commit 96ef18e

Browse files
authored
PYPI publish metadata bufix (#543)
* update workflow * install python * d * d * add vers * add dynamic version * update name * stable vers * revert name * add in other os and python versions * change tow orkflow dispatch * force bash shell for windows * revert version collection method
1 parent 5fe4dd0 commit 96ef18e

File tree

1 file changed

+67
-6
lines changed

1 file changed

+67
-6
lines changed

.github/workflows/build_tests.yml

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,38 @@ jobs:
4343
done
4444
fi
4545
- name: Build wheels
46-
uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0
46+
uses: pypa/[email protected]
4747
env:
4848
CIBW_ENVIRONMENT: BUILD_WNTR_EXTENSIONS='true'
4949
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-*
5050
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*"
5151
CIBW_REPAIR_WHEEL_COMMAND: '' # Skip repair step
52+
- name: Set up Python for twine verification
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: '3.11'
56+
- name: Install twine and verify wheels
57+
shell: bash
58+
run: |
59+
python -m pip install --upgrade pip
60+
pip install twine
61+
for wheel in ./wheelhouse/*.whl; do
62+
echo "Verifying wheel: $wheel"
63+
twine check "$wheel"
64+
done
5265
- name: Fix macos13 wheel names # For some reason, they come out as macos14 instead of macos13
5366
if: ${{ matrix.os == 'macOS-13'}}
5467
run: |
68+
echo "=== Before renaming ==="
69+
ls -la ./wheelhouse/
5570
for file in ./wheelhouse/*.whl; do
71+
echo "Original file: $file"
5672
new_name=$(echo "$file" | sed 's/macosx_14_0/macosx_13_0/')
73+
echo "New name: $new_name"
5774
mv "$file" "$new_name"
5875
done
76+
echo "=== After renaming ==="
77+
ls -la ./wheelhouse/
5978
- name: Fix linux wheel names # This is a bit dishonest, since the wheels are not properly repaired to be manylinux compatible. This is a (hopefully) temporary hack to get our wheels onto pypi.
6079
if: ${{ matrix.os == 'ubuntu-latest' }}
6180
run: |
@@ -66,7 +85,7 @@ jobs:
6685
echo "Renamed: $file -> $new_file"
6786
done
6887
- name: Upload wheels
69-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
88+
uses: actions/upload-artifact@v4
7089
with:
7190
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
7291
path: ./wheelhouse/*.whl
@@ -78,7 +97,7 @@ jobs:
7897
strategy:
7998
matrix:
8099
python-version: ['3.10', '3.11', '3.12', '3.13']
81-
os: [windows-latest, macOS-13, macos-latest, ubuntu-latest]
100+
os: [ubuntu-latest, windows-latest, macOS-13, macos-latest]
82101
fail-fast: false
83102
steps:
84103
- name: Set up Python
@@ -125,7 +144,7 @@ jobs:
125144
strategy:
126145
matrix:
127146
python-version: ['3.10', '3.11', '3.12', '3.13']
128-
os: [windows-latest, macOS-13, ubuntu-latest, macos-latest]
147+
os: [ubuntu-latest, windows-latest, macOS-13, macos-latest]
129148
fail-fast: false
130149
steps:
131150
- uses: actions/checkout@v4
@@ -233,6 +252,47 @@ jobs:
233252
name: sdist
234253
path: dist/*.tar.gz
235254

255+
publish-to-testpypi:
256+
name: Publish Python 🐍 distribution 📦 to TestPyPI
257+
needs: [build_sdist, test_wheels]
258+
runs-on: ubuntu-latest
259+
environment:
260+
name: testpypi
261+
url: https://test.pypi.org/project/wntr
262+
permissions:
263+
id-token: write
264+
if: github.event_name == 'workflow_dispatch'
265+
steps:
266+
- name: Download wheel artifacts
267+
uses: actions/download-artifact@v4
268+
with:
269+
pattern: cibw-*
270+
path: dist
271+
merge-multiple: true
272+
- name: Download SDist artifact
273+
uses: actions/download-artifact@v4
274+
with:
275+
name: sdist
276+
path: dist
277+
- name: Debug wheel files before upload
278+
run: |
279+
echo "=== Wheel files to upload ==="
280+
ls -la dist/
281+
echo "=== Wheel file details ==="
282+
for wheel in dist/*.whl; do
283+
echo "File: $wheel"
284+
file "$wheel"
285+
unzip -l "$wheel" | head -10
286+
echo "---"
287+
done
288+
- name: Publish to TestPyPI
289+
uses: pypa/gh-action-pypi-publish@release/v1
290+
with:
291+
repository-url: https://test.pypi.org/legacy/
292+
user: __token__
293+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
294+
verbose: true
295+
236296
publish-to-pypi:
237297
name: Publish Python 🐍 distribution 📦 to PyPI
238298
needs: [build_sdist, test_wheels]
@@ -244,7 +304,7 @@ jobs:
244304
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
245305
steps:
246306
- name: Download wheel artifacts
247-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
307+
uses: actions/download-artifact@v4
248308
with:
249309
pattern: cibw-*
250310
path: dist
@@ -255,7 +315,8 @@ jobs:
255315
name: sdist
256316
path: dist
257317

258-
- uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # release/v1
318+
- uses: pypa/gh-action-pypi-publish@release/v1
259319
with:
260320
user: __token__
261321
password: ${{ secrets.PYPI_WNTR_API_TOKEN }}
322+

0 commit comments

Comments
 (0)