Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions .github/workflows/CI-runpod_dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,43 @@ jobs:
- name: Check for new package version and update
run: |
echo "Fetching the current runpod version from requirements.txt..."
# Get current version (supports '~=' versioning)
current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)

# Get current version (supports '>=' versioning)
current_version=$(grep -oP 'runpod>=\K[^ ]+' ./builder/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 "ERROR: Failed to fetch the new version from PyPI."
exit 1
fi
# Extract major and minor from current version (e.g., 1.7)
current_major_minor=$(echo $current_version | cut -d. -f1,2)
new_major_minor=$(echo $new_version | cut -d. -f1,2)
echo "Current major.minor: $current_major_minor"
echo "New major.minor: $new_major_minor"
# Check if the new version is within the current major.minor range (e.g., 1.7.x)
if [ "$new_major_minor" = "$current_major_minor" ]; then
echo "No update needed. The new version ($new_version) is within the allowed range (~= $current_major_minor)."

if [ -z "$current_version" ]; then
echo "ERROR: Failed to extract current version from requirements.txt."
exit 1
fi

# Compare versions using sort -V (version sort)
if [ "$current_version" = "$new_version" ]; then
echo "No update needed. Already at version $new_version."
exit 0
fi

# 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 major/minor detected ($new_major_minor). Updating runpod version..."
# Update requirements.txt with the new version while keeping '~='
sed -i "s/runpod~=.*/runpod~=$new_version/" ./builder/requirements.txt

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/" ./builder/requirements.txt
echo "requirements.txt has been updated."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
Expand Down
2 changes: 1 addition & 1 deletion builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Required Python packages get listed here, one per line.
# Reccomended to lock the version number to avoid unexpected changes.

runpod~=1.7.0
runpod>=1.8.0