Skip to content

Commit

Permalink
Merge pull request #5 from runpod-workers/dependency-update-refactored
Browse files Browse the repository at this point in the history
Runpod package dependency updater
  • Loading branch information
pandyamarut authored Oct 24, 2024
2 parents 2cf0b06 + 86a2b9f commit 1c67c28
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/CI-runpod_dep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI | Update runpod package version

on:
repository_dispatch:
types: [python-package-release]

push:
branches: ["main"]

workflow_dispatch:

jobs:
check_dep:
runs-on: ubuntu-latest
name: Check python requirements file and update
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check for new package version and update
run: |
echo "Fetching the current runpod version from requirements.txt..."
# 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 "ERROR: Failed to fetch the new version from PyPI."
exit 1
fi
# 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
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
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update package version
title: Update runpod package version
body: The package version has been updated to ${{ env.NEW_VERSION_ENV }}
branch: runpod-package-update
2 changes: 1 addition & 1 deletion builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Required Python packages get listed here, one per line.
# Reccomended to lock the version number to avoid unexpected changes.

runpod==0.9.10
runpod~=1.7.0
tqdm==4.64.1
torch==1.13.0
torchaudio==0.13.0
Expand Down

0 comments on commit 1c67c28

Please sign in to comment.