From eba20c0704e7e91f352d8a1bcb30ab3bd08ef514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dean=20Qui=C3=B1anola?= Date: Sat, 12 Oct 2024 16:47:31 -0700 Subject: [PATCH] Update CI-runpod_dep.yml Dependency has changed to `runpod~=` and not `runpod==` --- .github/workflows/CI-runpod_dep.yml | 37 +++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI-runpod_dep.yml b/.github/workflows/CI-runpod_dep.yml index 5a14972..e99d828 100644 --- a/.github/workflows/CI-runpod_dep.yml +++ b/.github/workflows/CI-runpod_dep.yml @@ -19,32 +19,49 @@ jobs: - name: Check for new package version and update run: | - # Get current version - current_version=$(grep -oP 'runpod==\K[^"]+' ./builder/requirements.txt) + echo "Fetching the current runpod version from requirements.txt..." + + # Get current version, allowing both == and ~= in the search pattern + current_version=$(grep -oP 'runpod[~=]{1,2}\K[^"]+' ./builder/requirements.txt) + echo "Current version: $current_version" - # Get new version + # Extract major and minor from current version + current_major_minor=$(echo $current_version | cut -d. -f1,2) + echo "Current major.minor: $current_major_minor" + + echo "Fetching the latest runpod version from PyPI..." + + # Get new version from PyPI new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version) echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV + echo "New version: $new_version" + + # Extract major and minor from new version + new_major_minor=$(echo $new_version | cut -d. -f1,2) + echo "New major.minor: $new_major_minor" if [ -z "$new_version" ]; then - echo "Failed to fetch the new version." + echo "ERROR: Failed to fetch the new version from PyPI." exit 1 fi - # Check if the version is already up-to-date - if [ "$current_version" = "$new_version" ]; then - echo "The package version is already up-to-date." + # Check if the major or minor version is different + if [ "$current_major_minor" = "$new_major_minor" ]; then + echo "No update needed. The new version ($new_major_minor) is within the allowed range (~= $current_major_minor)." exit 0 fi - # Update requirements.txt - sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt + echo "New major/minor detected ($new_major_minor). Updating requirements.txt..." + + # Update requirements.txt, preserving the existing constraint type (~= or ==) + sed -i "s/runpod[~=][^ ]*/runpod~=$new_version/" ./builder/requirements.txt + echo "requirements.txt has been updated." - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update package version + commit-message: Update runpod package version title: Update runpod package version body: The package version has been updated to ${{ env.NEW_VERSION_ENV }} branch: runpod-package-update