Skip to content

Commit

Permalink
Merge pull request #3 from runpod-workers/dependency-update-refactored
Browse files Browse the repository at this point in the history
Dependency has changed to runpod~=<version> and not runpod==<version>
  • Loading branch information
pandyamarut authored Oct 17, 2024
2 parents 66d5f97 + e0ee92d commit abd769a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/CI-runpod_dep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,40 @@ jobs:

- name: Check for new package version and update
run: |
# Get current version
current_version=$(grep -oP 'runpod==\K[^"]+' ./builder/requirements.txt)
echo "Fetching the current runpod version from requirements.txt..."
# Get new version
# Get current version (supports '~=' versioning)
current_version=$(grep -oP 'runpod~=\K[^ ]+' ./builder/requirements.txt)
echo "Current version: $current_version"
# Get new version from PyPI
new_version=$(curl -s https://pypi.org/pypi/runpod/json | jq -r .info.version)
echo "NEW_VERSION_ENV=$new_version" >> $GITHUB_ENV
echo "New version: $new_version"
if [ -z "$new_version" ]; then
echo "Failed to fetch the new version."
echo "ERROR: Failed to fetch the new version from PyPI."
exit 1
fi
# Check if the version is already up-to-date
if [ "$current_version" = "$new_version" ]; then
echo "The package version is already up-to-date."
# Extract major and minor from current version (e.g., 1.7)
current_major_minor=$(echo $current_version | cut -d. -f1,2)
new_major_minor=$(echo $new_version | cut -d. -f1,2)
echo "Current major.minor: $current_major_minor"
echo "New major.minor: $new_major_minor"
# Check if the new version is within the current major.minor range (e.g., 1.7.x)
if [ "$new_major_minor" = "$current_major_minor" ]; then
echo "No update needed. The new version ($new_version) is within the allowed range (~= $current_major_minor)."
exit 0
fi
# Update requirements.txt
sed -i "s/runpod==.*/runpod==$new_version/" ./builder/requirements.txt
echo "New major/minor detected ($new_major_minor). Updating runpod version..."
# Update requirements.txt with the new version while keeping '~='
sed -i "s/runpod~=.*/runpod~=$new_version/" ./builder/requirements.txt
echo "requirements.txt has been updated."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
Expand Down
2 changes: 1 addition & 1 deletion builder/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# git+https://github.com/runpod/runpod-python.git
# To learn more, see https://pip.pypa.io/en/stable/reference/requirements-file-format/

runpod==1.6.2
runpod~=1.7.0

0 comments on commit abd769a

Please sign in to comment.