generated from runpod-workers/worker-template
-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (50 loc) · 2.29 KB
/
CI-runpod_dep.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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