From 3407de190768fdc6888489afb6a33e522c2ee329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dean=20Qui=C3=B1anola?= Date: Thu, 20 Nov 2025 21:14:43 -0800 Subject: [PATCH] refactor: Update CI workflow to support runpod>= versioning Changes: - Update grep pattern from runpod~= to runpod>= - Replace major.minor range logic with semantic version comparison - Add validation for current_version extraction - Update sed replacement to maintain >= operator - Workflow now triggers on any version increase (patch, minor, major) Previously, the workflow only updated for major.minor changes due to ~= (compatible release) constraint. Now with >=, all new releases are honored. --- .github/workflows/CI-runpod_dep.yml | 35 ++++++++++++++++++++++------- requirements.txt | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI-runpod_dep.yml b/.github/workflows/CI-runpod_dep.yml index 5a14972e..749dbde7 100644 --- a/.github/workflows/CI-runpod_dep.yml +++ b/.github/workflows/CI-runpod_dep.yml @@ -19,26 +19,45 @@ 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 new version + # Get current version (supports '>=' versioning) + current_version=$(grep -oP 'runpod>=\K[^ ]+' ./requirements.txt) + echo "Current version: $current_version" + + # 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" 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 + + if [ -z "$current_version" ]; then + echo "ERROR: Failed to extract current version from requirements.txt." exit 1 fi - # Check if the version is already up-to-date + # Compare versions using sort -V (version sort) if [ "$current_version" = "$new_version" ]; then - echo "The package version is already up-to-date." + echo "No update needed. Already at version $new_version." exit 0 fi - # Update requirements.txt - sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt + # Check if new version is actually newer + newer_version=$(printf "%s\n%s" "$current_version" "$new_version" | sort -V | tail -n1) + if [ "$newer_version" = "$current_version" ]; then + echo "No update needed. Current version ($current_version) is already >= new version ($new_version)." + exit 0 + fi + + echo "New version detected ($new_version > $current_version). Updating runpod version..." + + # Update requirements.txt with the new version while keeping '>=' + sed -i "s/runpod>=.*/runpod>=$new_version/" ./requirements.txt + echo "requirements.txt has been updated." - name: Create Pull Request uses: peter-evans/create-pull-request@v3 diff --git a/requirements.txt b/requirements.txt index e079d600..f117d58c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -runpod~=1.7.9 \ No newline at end of file +runpod>=1.8.0