diff --git a/.github/workflows/generate-index-from-release.yaml b/.github/workflows/generate-index-from-release.yaml index bb096098..4c7aad31 100644 --- a/.github/workflows/generate-index-from-release.yaml +++ b/.github/workflows/generate-index-from-release.yaml @@ -41,12 +41,12 @@ jobs: - name: Build run: | - ./scripts/releases-to-pep-503.sh index/whl/cpu '^[v]?[0-9]+\.[0-9]+\.[0-9]+$' - # ./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu121$' - # ./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu122$' - # ./scripts/releases-to-pep-503.sh index/whl/cu123 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu123$' - ./scripts/releases-to-pep-503.sh index/whl/cu124 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$' - ./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+-metal$' + ./scripts/releases-to-pep-503.sh index/whl/cpu '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$' + # ./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-cu121$' + # ./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-cu122$' + # ./scripts/releases-to-pep-503.sh index/whl/cu123 '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-cu123$' + ./scripts/releases-to-pep-503.sh index/whl/cu124 '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-cu124$' + ./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?-metal$' - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/scripts/releases-to-pep-503.sh b/scripts/releases-to-pep-503.sh index c7eaae90..7f35bee2 100644 --- a/scripts/releases-to-pep-503.sh +++ b/scripts/releases-to-pep-503.sh @@ -7,12 +7,15 @@ repo_name="nexa-sdk" output_dir=${1:-"index/whl/cpu"} # Create output directory +echo "Creating output directory: $output_dir" mkdir -p $output_dir # Change to output directory +echo "Changing to output directory: $output_dir" pushd $output_dir # Create an index html file +echo "Creating index.html in $output_dir" echo "" > index.html echo "" >> index.html echo " " >> index.html @@ -24,20 +27,27 @@ echo "" >> index.html echo "" >> index.html # Create ${package_name} directory +echo "Creating package directory: ${package_name}" mkdir -p ${package_name} # Change to ${package_name} directory +echo "Changing to package directory: ${package_name}" pushd ${package_name} # Create an index html file +echo "Creating index.html in ${package_name} directory" echo "" > index.html echo "" >> index.html echo " " >> index.html echo "

Links for ${package_name}

" >> index.html # Get all releases +echo "Fetching all releases from GitHub for repository: ${repo_name}" releases=$(curl -s https://api.github.com/repos/NexaAI/${repo_name}/releases | jq -r .[].tag_name) +# Output all retrieved releases for debugging +echo "All releases retrieved: $releases" + # Get pattern from second arg or default to valid python package version pattern # pattern example 1 : v0.1.0 # pattern example 2 : 0.1.0 @@ -47,36 +57,58 @@ releases=$(curl -s https://api.github.com/repos/NexaAI/${repo_name}/releases | j pattern=${2:-"^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-zA-Z0-9]+)?$"} # Filter releases by pattern +echo "Filtering releases with pattern: $pattern" releases=$(echo $releases | tr ' ' '\n' | grep -E $pattern) +# Output filtered releases for debugging +echo "Filtered releases: $releases" + # For each release, get all assets for release in $releases; do + echo "Processing release: $release" assets=$(curl -s https://api.github.com/repos/NexaAI/${repo_name}/releases/tags/$release | jq -r .assets) - # Get release version from release ie v0.1.0-cu121 -> v0.1.0 - release_version=$(echo $release | grep -oE "^[v]?[0-9]+\.[0-9]+\.[0-9]+") + + # Extract full release version without removing any segments + release_version=$(echo $release | grep -oE "^[v]?[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-zA-Z0-9]+)?$") + + # Debugging output for each release + echo "Extracted version: $release_version" + echo "Assets found for release $release_version:" + echo $assets | jq -r .[].browser_download_url + echo "

$release_version

" >> index.html for asset in $(echo $assets | jq -r .[].browser_download_url); do if [[ $asset == *".whl" ]]; then + echo "Adding wheel to index: $asset" echo " $asset" >> index.html echo "
" >> index.html + else + echo "Skipping non-wheel asset: $asset" fi done done +echo "Closing HTML tags in index.html" echo " " >> index.html echo "" >> index.html echo "" >> index.html # Extract the version from the output_dir (e.g., "cpu" from "index/whl/cpu") version=$(basename "$output_dir") +echo "Extracted version from output directory: $version" # If this is the CPU version, create the root index.html if [ "$version" == "cpu" ]; then + echo "Creating root index.html since version is CPU" + # Return to original directory popd popd root_dir=$(dirname "$output_dir") + echo "Root directory: $root_dir" + echo "Creating index.html in root directory" + echo "" > "$root_dir/index.html" echo "" >> "$root_dir/index.html" echo " " >> "$root_dir/index.html" @@ -90,4 +122,6 @@ if [ "$version" == "cpu" ]; then echo " CUDA 12.4
" >> "$root_dir/index.html" echo " " >> "$root_dir/index.html" echo "" >> "$root_dir/index.html" -fi \ No newline at end of file +fi + +echo "Script execution completed."