@@ -19,32 +19,49 @@ 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..."
23+
24+ # Get current version, allowing both == and ~= in the search pattern
25+ current_version=$(grep -oP 'runpod[~=]{1,2}\K[^"]+' ./builder/requirements.txt)
26+ echo "Current version: $current_version"
2427
25- # Get new version
28+ # Extract major and minor from current version
29+ current_major_minor=$(echo $current_version | cut -d. -f1,2)
30+ echo "Current major.minor: $current_major_minor"
31+
32+ echo "Fetching the latest runpod version from PyPI..."
33+
34+ # Get new version from PyPI
2635 new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
2736 echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
37+ echo "New version: $new_version"
38+
39+ # Extract major and minor from new version
40+ new_major_minor=$(echo $new_version | cut -d. -f1,2)
41+ echo "New major.minor: $new_major_minor"
2842
2943 if [ -z "$new_version" ]; then
30- echo "Failed to fetch the new version."
44+ echo "ERROR: Failed to fetch the new version from PyPI ."
3145 exit 1
3246 fi
3347
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 ."
48+ # Check if the major or minor version is different
49+ if [ "$current_major_minor " = "$new_major_minor " ]; then
50+ echo "No update needed. The new version ($new_major_minor) is within the allowed range (~= $current_major_minor) ."
3751 exit 0
3852 fi
3953
40- # Update requirements.txt
41- sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt
54+ echo "New major/minor detected ($new_major_minor). Updating requirements.txt..."
55+
56+ # Update requirements.txt, preserving the existing constraint type (~= or ==)
57+ sed -i "s/runpod[~=][^ ]*/runpod~=$new_version/" ./builder/requirements.txt
58+ echo "requirements.txt has been updated."
4259
4360 - name : Create Pull Request
4461 uses : peter-evans/create-pull-request@v3
4562 with :
4663 token : ${{ secrets.GITHUB_TOKEN }}
47- commit-message : Update package version
64+ commit-message : Update runpod package version
4865 title : Update runpod package version
4966 body : The package version has been updated to ${{ env.NEW_VERSION_ENV }}
5067 branch : runpod-package-update
0 commit comments