[CI] release-whl-kernel: strip +cu129 local version before PyPI upload (#23749)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kangyan-Zhou
2026-04-25 22:14:45 -07:00
committed by GitHub
co-authored by Claude Opus 4.7
parent 3cfd1561df
commit 4be853e1c6
+32 -1
View File
@@ -78,11 +78,42 @@ jobs:
BUILD_JOBS: 64 BUILD_JOBS: 64
NVCC_THREADS: 8 NVCC_THREADS: 8
# rename_wheels.sh tags the cu129 wheel's METADATA Version with +cu129
# (needed elsewhere — e.g. local install discrimination — see PR #23587),
# but PyPI rejects PEP 440 local version labels with HTTP 400. Repack a
# PyPI-clean copy with the +cu129 segment stripped into dist-pypi/, and
# upload that copy. dist/ is left untouched so the +cu129 wheel still
# flows through the upload-artifact -> sgl-project/whl index path below.
- name: Strip +cu129 local version for PyPI upload
working-directory: sgl-kernel
run: |
set -eux
pip install wheel
mkdir -p dist-pypi
for w in dist/*.whl; do
tmp=$(mktemp -d)
python3 -m wheel unpack "$w" --dest "$tmp"
unpacked=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1)
info=$(find "$unpacked" -maxdepth 1 -type d -name "*.dist-info" | head -1)
meta="$info/METADATA"
orig=$(grep '^Version:' "$meta" | head -1 | sed 's/^Version:[[:space:]]*//')
new=$(echo "$orig" | sed 's/+cu[0-9]\+$//')
if [ "$orig" != "$new" ]; then
sed -i "s/^Version:.*/Version: ${new}/" "$meta"
old_base=$(basename "$info")
new_base="${old_base/${orig}/${new}}"
mv "$info" "$(dirname "$info")/${new_base}"
fi
python3 -m wheel pack "$unpacked" --dest-dir dist-pypi
rm -rf "$tmp"
done
ls -lh dist-pypi/
- name: Upload to PyPI - name: Upload to PyPI
working-directory: sgl-kernel working-directory: sgl-kernel
run: | run: |
pip install twine pip install twine
python3 -m twine upload --skip-existing dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN_SGLANG_KERNEL }} python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.PYPI_TOKEN_SGLANG_KERNEL }}
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4