Skip to content

Commit 82163b1

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 eab9013 commit 82163b1

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.github/workflows/CI-runpod_dep.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,43 @@ jobs:
2020
- name: Check for new package version and update
2121
run: |
2222
echo "Fetching the current runpod version from requirements.txt..."
23-
# Get current version (supports '~=' versioning)
24-
current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)
23+
24+
# Get current version (supports '>=' versioning)
25+
current_version=$(grep -oP 'runpod>=\K[^ ]+' ./builder/requirements.txt)
2526
echo "Current version: $current_version"
27+
2628
# Get new version from PyPI
2729
new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
2830
echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
2931
echo "New version: $new_version"
32+
3033
if [ -z "$new_version" ]; then
3134
echo "ERROR: Failed to fetch the new version from PyPI."
3235
exit 1
3336
fi
34-
# Extract major and minor from current version (e.g., 1.7)
35-
current_major_minor=$(echo $current_version | cut -d. -f1,2)
36-
new_major_minor=$(echo $new_version | cut -d. -f1,2)
37-
echo "Current major.minor: $current_major_minor"
38-
echo "New major.minor: $new_major_minor"
39-
# Check if the new version is within the current major.minor range (e.g., 1.7.x)
40-
if [ "$new_major_minor" = "$current_major_minor" ]; then
41-
echo "No update needed. The new version ($new_version) is within the allowed range (~= $current_major_minor)."
37+
38+
if [ -z "$current_version" ]; then
39+
echo "ERROR: Failed to extract current version from requirements.txt."
40+
exit 1
41+
fi
42+
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
48+
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)."
4253
exit 0
4354
fi
44-
echo "New major/minor detected ($new_major_minor). Updating runpod version..."
45-
# Update requirements.txt with the new version while keeping '~='
46-
sed -i "s/runpod~=.*/runpod~=$new_version/" ./builder/requirements.txt
55+
56+
echo "New version detected ($new_version > $current_version). Updating runpod version..."
57+
58+
# Update requirements.txt with the new version while keeping '>='
59+
sed -i "s/runpod>=.*/runpod>=$new_version/" ./builder/requirements.txt
4760
echo "requirements.txt has been updated."
4861
- name: Create Pull Request
4962
uses: peter-evans/create-pull-request@v3

builder/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Required Python packages get listed here, one per line.
22
# Reccomended to lock the version number to avoid unexpected changes.
33

4-
runpod~=1.7.0
4+
runpod>=1.8.0

0 commit comments

Comments
 (0)