|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Get output directory or default to index/whl/cpu |
| 4 | +output_dir=${1:-"index/whl/cpu"} |
| 5 | + |
| 6 | +# Create output directory |
| 7 | +mkdir -p $output_dir |
| 8 | + |
| 9 | +# Change to output directory |
| 10 | +pushd $output_dir |
| 11 | + |
| 12 | +# Create an index html file |
| 13 | +echo "<!DOCTYPE html>" > index.html |
| 14 | +echo "<html>" >> index.html |
| 15 | +echo " <head></head>" >> index.html |
| 16 | +echo " <body>" >> index.html |
| 17 | +echo " <a href=\"llama-cpp-python/\">llama-cpp-python</a>" >> index.html |
| 18 | +echo " <br>" >> index.html |
| 19 | +echo " </body>" >> index.html |
| 20 | +echo "</html>" >> index.html |
| 21 | +echo "" >> index.html |
| 22 | + |
| 23 | +# Create llama-cpp-python directory |
| 24 | +mkdir -p llama-cpp-python |
| 25 | + |
| 26 | +# Change to llama-cpp-python directory |
| 27 | +pushd llama-cpp-python |
| 28 | + |
| 29 | +# Create an index html file |
| 30 | +echo "<!DOCTYPE html>" > index.html |
| 31 | +echo "<html>" >> index.html |
| 32 | +echo " <body>" >> index.html |
| 33 | +echo " <h1>Links for llama-cpp-python</h1>" >> index.html |
| 34 | + |
| 35 | +# Get all releases |
| 36 | +releases=$(curl -s https://api.github.com/repos/abetlen/llama-cpp-python/releases | jq -r .[].tag_name) |
| 37 | + |
| 38 | +# Get pattern from second arg or default to valid python package version pattern |
| 39 | +pattern=${2:-"^[v]?[0-9]+\.[0-9]+\.[0-9]+$"} |
| 40 | + |
| 41 | +<
8000
/span># Filter releases by pattern |
| 42 | +releases=$(echo $releases | tr ' ' '\n' | grep -E $pattern) |
| 43 | + |
| 44 | +# For each release, get all assets |
| 45 | +for release in $releases; do |
| 46 | + assets=$(curl -s https://api.github.com/repos/abetlen/llama-cpp-python/releases/tags/$release | jq -r .assets) |
| 47 | + echo " <h2>$release</h2>" >> index.html |
| 48 | + for asset in $(echo $assets | jq -r .[].browser_download_url); do |
| 49 | + if [[ $asset == *".whl" ]]; then |
| 50 | + echo " <a href=\"$asset\">$asset</a>" >> index.html |
| 51 | + echo " <br>" >> index.html |
| 52 | + fi |
| 53 | + done |
| 54 | +done |
| 55 | + |
| 56 | +echo " </body>" >> index.html |
| 57 | +echo "</html>" >> index.html |
| 58 | +echo "" >> index.html |
0 commit comments