Skip to content

Commit 0c0a5cd

Browse files
committed
refactor: Update CI workflow to support runpod>= versioning
Changes: - Update grep pattern from runpod~= to runpod>= - Replace major.minor range logic with semantic version comparison - Add validation for current_version extraction - Update sed replacement to maintain >= operator - Workflow now triggers on any version increase (patch, minor, major) Previously, the workflow only updated for major.minor changes due to ~= (compatible release) constraint. Now with >=, all new releases are honored.
1 parent be6c2ec commit 0c0a5cd

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

.github/workflows/CI-runpod_dep.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
run: |
2222
echo "Fetching the current runpod version from requirements.txt..."
2323
24-
# Get current version (supports '~=' versioning)
25-
current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)
24+
# Get current version (supports '>=' versioning)
25+
current_version=$(grep -oP 'runpod>=\K[^ ]+' ./builder/requirements.txt)
2626
echo "Current version: $current_version"
2727
2828
# Get new version from PyPI
@@ -35,23 +35,28 @@ jobs:
3535
exit 1
3636
fi
3737
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)
38+
if [ -z "$current_version" ]; then
39+
echo "ERROR: Failed to extract current version from requirements.txt."
40+
exit 1
41+
fi
4142
42-
echo "Current major.minor: $current_major_minor"
43-
echo "New major.minor: $new_major_minor"
43+
# Compare versions using sort -V (version sort)
44+
if [ "$current_version" = "$new_version" ]; then
45+
echo "No update needed. Already at version $new_version."
46+
exit 0
47+
fi
4448
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)."
49+
# Check if new version is actually newer
50+
newer_version=$(printf "%s\n%s" "$current_version" "$new_version" | sort -V | tail -n1)
51+
if [ "$newer_version" = "$current_version" ]; then
52+
echo "No update needed. Current version ($current_version) is already >= new version ($new_version)."
4853
exit 0
4954
fi
5055
51-
echo "New major/minor detected ($new_major_minor). Updating runpod version..."
56+
echo "New version detected ($new_version > $current_version). Updating runpod version..."
5257
53-
# Update requirements.txt with the new version while keeping '~='
54-
sed -i "s/runpod~=.*/runpod~=$new_version/" ./builder/requirements.txt
58+
# Update requirements.txt with the new version while keeping '>='
59+
sed -i "s/runpod>=.*/runpod>=$new_version/" ./builder/requirements.txt
5560
echo "requirements.txt has been updated."
5661
5762
- name: Create Pull Request

builder/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ray
99
pandas
1010
pyarrow
11-
runpod~=1.7.0
11+
runpod>=1.8.0
1212
huggingface-hub
1313
packaging
1414
typing-extensions==4.7.1

0 commit comments

Comments
 (0)