@@ -19,32 +19,49 @@ jobs:
19
19
20
20
- name : Check for new package version and update
21
21
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"
24
27
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
26
35
new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
27
36
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"
28
42
29
43
if [ -z "$new_version" ]; then
30
- echo "Failed to fetch the new version."
44
+ echo "ERROR: Failed to fetch the new version from PyPI ."
31
45
exit 1
32
46
fi
33
47
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) ."
37
51
exit 0
38
52
fi
39
53
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."
42
59
43
60
- name : Create Pull Request
44
61
uses : peter-evans/create-pull-request@v3
45
62
with :
46
63
token : ${{ secrets.GITHUB_TOKEN }}
47
- commit-message : Update package version
64
+ commit-message : Update runpod package version
48
65
title : Update runpod package version
49
66
body : The package version has been updated to ${{ env.NEW_VERSION_ENV }}
50
67
branch : runpod-package-update
0 commit comments