@@ -19,26 +19,40 @@ 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..."
24
23
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
26
29
new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
27
30
echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
31
+ echo "New version: $new_version"
28
32
29
33
if [ -z "$new_version" ]; then
30
- echo "Failed to fetch the new version."
34
+ echo "ERROR: Failed to fetch the new version from PyPI ."
31
35
exit 1
32
36
fi
33
37
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)."
37
48
exit 0
38
49
fi
39
50
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."
42
56
43
57
- name : Create Pull Request
44
58
uses : peter-evans/create-pull-request@v3
0 commit comments