diff --git a/.ci/update-index.py b/.ci/update-index.py new file mode 100755 index 0000000..85354b7 --- /dev/null +++ b/.ci/update-index.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 + +import os +import packaging.utils +import requests +import sys + +def main(): + # Check if the correct number of command-line arguments is provided + if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} ") + sys.exit(1) + + # Extract the repository path from the command-line arguments + repository = sys.argv[1] + + # Fetch releases from the GitHub API for the specified repository + response = requests.get(f"https://api.github.com/repos/{repository}/releases") + + # Raise an error if the request was unsuccessful + response.raise_for_status() + + # Parse the response JSON + data = response.json() + + # Initialize variable to hold the assets of the first non-prerelease + assets = None + + # Loop through the releases to find the first non-prerelease + for release in data: + if not release["prerelease"]: + assets = release["assets"] + break + + # Dictionary to hold package information + packages = {} + + # Process each asset in the release + for asset in assets: + # Get the asset name and download URL + name = asset["name"] + url = asset["browser_download_url"] + + # Parse the wheel filename to extract package information + parsed = packaging.utils.parse_wheel_filename(name) + + # Extract the package name from the parsed information + package_name = parsed[0] + + # Initialize the package entry in the dictionary if not already present + if package_name not in packages: + packages[package_name] = [] + + # Append the asset information to the package entry + packages[package_name].append((name, url)) + + # Generate HTML pages for each package + for package_name, wheels in packages.items(): + # Create a directory for the package + os.makedirs(f"_site/{package_name}", exist_ok=True) + + # Create an index.html file for the package + with open(f"_site/{package_name}/index.html", "w") as file: + file.write("") + file.write("") + file.write("") + file.write(f"

Links for {package_name}

") + # Add links to each wheel file + for (wheel_name, wheel_url) in wheels: + file.write(f'{wheel_name}
') + file.write("") + file.write("") + + # Create the main index.html file + os.makedirs("_site", exist_ok=True) + with open("_site/index.html", "w") as file: + file.write("") + file.write("") + file.write("") + # Add links to each package + for package_name in packages.keys(): + file.write(f'{package_name}
') + file.write("") + file.write("") + +if __name__ == "__main__": + main() diff --git a/.github/workflows/build-triton.yml b/.github/workflows/build-triton.yml index 32b2194..eeec4fe 100644 --- a/.github/workflows/build-triton.yml +++ b/.github/workflows/build-triton.yml @@ -4,6 +4,9 @@ jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + steps: - name: Checkout uses: actions/checkout@v4 @@ -43,6 +46,7 @@ jobs: - name: Create release uses: softprops/action-gh-release@v2 with: + draft: true files: wheelhouse/*.whl tag_name: ${{ github.event.inputs.tag_name }} @@ -69,6 +73,3 @@ on: description: Target tag required: true type: string - -permissions: - contents: write diff --git a/.github/workflows/build-vllm.yml b/.github/workflows/build-vllm.yml index cad984c..6a62e6e 100644 --- a/.github/workflows/build-vllm.yml +++ b/.github/workflows/build-vllm.yml @@ -4,6 +4,9 @@ jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + steps: - name: Checkout uses: actions/checkout@v4 @@ -45,6 +48,7 @@ jobs: - name: Create release uses: softprops/action-gh-release@v2 with: + draft: true files: wheelhouse/*.whl tag_name: ${{ github.event.inputs.tag_name }} @@ -71,6 +75,3 @@ on: description: Target tag required: true type: string - -permissions: - contents: write diff --git a/.github/workflows/update-index.yml b/.github/workflows/update-index.yml new file mode 100644 index 0000000..626f9fd --- /dev/null +++ b/.github/workflows/update-index.yml @@ -0,0 +1,42 @@ +name: Update package index + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.ref }} + repository: ${{ github.event.inputs.repository }} + + - name: Generate package index + run: .ci/update-index.py ${{ github.repository }} + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + deploy: + needs: build + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + permissions: + id-token: write + pages: write + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + +on: + release: + types: + - released + + workflow_dispatch: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57510a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +_site/