@@ -19,32 +19,46 @@ 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)
22+ echo "Fetching the current runpod version from requirements.txt..."
2423
25- # Get new version
24+ # Get current version (supports '~=' versioning)
25+ current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)
26+ echo "Current version: $current_version"
27+
28+ # Get new version from PyPI
2629 new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
2730 echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
31+ echo "New version: $new_version"
2832
2933 if [ -z "$new_version" ]; then
30- echo "Failed to fetch the new version."
34+ echo "ERROR: Failed to fetch the new version from PyPI ."
3135 exit 1
3236 fi
3337
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."
38+ # Extract major and minor from current version (e.g., 1.7)
39+ current_major_minor=$(echo $current_version | cut -d. -f1,2)
40+ new_major_minor=$(echo $new_version | cut -d. -f1,2)
41+
42+ echo "Current major.minor: $current_major_minor"
43+ echo "New major.minor: $new_major_minor"
44+
45+ # Check if the new version is within the current major.minor range (e.g., 1.7.x)
46+ if [ "$new_major_minor" = "$current_major_minor" ]; then
47+ echo "No update needed. The new version ($new_version) is within the allowed range (~= $current_major_minor)."
3748 exit 0
3849 fi
3950
40- # Update requirements.txt
41- sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt
51+ echo "New major/minor detected ($new_major_minor). Updating runpod version..."
52+
53+ # Update requirements.txt with the new version while keeping '~='
54+ sed -i "s/runpod~=.*/runpod~=$new_version/" ./builder/requirements.txt
55+ echo "requirements.txt has been updated."
4256
4357 - name : Create Pull Request
4458 uses : peter-evans/create-pull-request@v3
4559 with :
4660 token : ${{ secrets.GITHUB_TOKEN }}
47- commit-message : Update package version
61+ commit-message : Update runpod package version
4862 title : Update runpod package version
4963 body : The package version has been updated to ${{ env.NEW_VERSION_ENV }}
5064 branch : runpod-package-update
0 commit comments