@@ -19,32 +19,37 @@ jobs:
1919
2020 - name : Check for new package version and update
2121 run : |
22- # Get current version
23- current_version=$(grep -oP 'runpod==\K[^"]+' ./builder/requirements.txt)
24-
25- # Get new version
22+ echo "Fetching the current runpod version from requirements.txt..."
23+ # Get current version (supports '~=' versioning)
24+ current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)
25+ echo "Current version: $current_version"
26+ # Get new version from PyPI
2627 new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
2728 echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
28-
29+ echo "New version: $new_version"
2930 if [ -z "$new_version" ]; then
30- echo "Failed to fetch the new version."
31+ echo "ERROR: Failed to fetch the new version from PyPI ."
3132 exit 1
3233 fi
33-
34- # Check if the version is already up-to-date
35- if [ "$current_version" = "$new_version" ]; then
36- echo "The package version is already up-to-date."
34+ # Extract major and minor from current version (e.g., 1.7)
35+ current_major_minor=$(echo $current_version | cut -d. -f1,2)
36+ new_major_minor=$(echo $new_version | cut -d. -f1,2)
37+ echo "Current major.minor: $current_major_minor"
38+ echo "New major.minor: $new_major_minor"
39+ # Check if the new version is within the current major.minor range (e.g., 1.7.x)
40+ if [ "$new_major_minor" = "$current_major_minor" ]; then
41+ echo "No update needed. The new version ($new_version) is within the allowed range (~= $current_major_minor)."
3742 exit 0
3843 fi
39-
40- # Update requirements.txt
41- sed -i "s/runpod== .*/runpod= =$new_version/" ./builder/requirements.txt
42-
44+ echo "New major/minor detected ($new_major_minor). Updating runpod version..."
45+ # Update requirements.txt with the new version while keeping '~='
46+ sed -i "s/runpod~= .*/runpod~ =$new_version/" ./builder/requirements.txt
47+ echo "requirements.txt has been updated."
4348 - name : Create Pull Request
4449 uses : peter-evans/create-pull-request@v3
4550 with :
4651 token : ${{ secrets.GITHUB_TOKEN }}
47- commit-message : Update package version
52+ commit-message : Update runpod package version
4853 title : Update runpod package version
4954 body : The package version has been updated to ${{ env.NEW_VERSION_ENV }}
5055 branch : runpod-package-update
0 commit comments