Skip to content

Commit

Permalink
Add step to update sgl-kernel whl index (#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
ispobock authored Jan 24, 2025
1 parent a22f60a commit 665e5e8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-whl-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
needs: build-wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -57,3 +59,20 @@ jobs:
token: ${{ secrets.WHL_TOKEN }}
files: |
sgl-kernel/dist/*
- name: Clone wheel index
run: git clone https://oauth2:${WHL_TOKEN}@github.com/sgl-project/whl.git sgl-whl
env:
WHL_TOKEN: ${{ secrets.WHL_TOKEN }}

- name: Update wheel index
run: python3 scripts/update_kernel_whl_index.py

- name: Push wheel index
run: |
cd sgl-whl
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "update whl index"
git push
16 changes: 16 additions & 0 deletions scripts/update_kernel_whl_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Reference: https://github.com/flashinfer-ai/flashinfer/blob/v0.2.0/scripts/update_whl_index.py

import hashlib
import pathlib
import re

for path in sorted(pathlib.Path("sgl-kernel/dist").glob("*.whl")):
with open(path, "rb") as f:
sha256 = hashlib.sha256(f.read()).hexdigest()
ver = re.findall(r"sgl_kernel-([0-9.]+(?:\.post[0-9]+)?)-", path.name)[0]
index_dir = pathlib.Path(f"sgl-whl/cu118")
index_dir.mkdir(exist_ok=True)
base_url = "https://github.com/sgl-project/whl/releases/download"
full_url = f"{base_url}/v{ver}/{path.name}#sha256={sha256}"
with (index_dir / "index.html").open("a") as f:
f.write(f'<a href="{full_url}">{path.name}</a><br>\n')

0 comments on commit 665e5e8

Please sign in to comment.