Publish to PyPI on minor increments (#10099)
This commit is contained in:
parent
edc8263120
commit
0fa42fbd7d
1 changed files with 10 additions and 2 deletions
10
.github/workflows/publish.yml
vendored
10
.github/workflows/publish.yml
vendored
|
|
@ -43,12 +43,20 @@ jobs:
|
||||||
|
|
||||||
v_local = tuple(map(int, ultralytics.__version__.split('.')))
|
v_local = tuple(map(int, ultralytics.__version__.split('.')))
|
||||||
v_pypi = tuple(map(int, check_latest_pypi_version().split('.')))
|
v_pypi = tuple(map(int, check_latest_pypi_version().split('.')))
|
||||||
|
|
||||||
print(f'Local version is {v_local}')
|
print(f'Local version is {v_local}')
|
||||||
print(f'PyPI version is {v_pypi}')
|
print(f'PyPI version is {v_pypi}')
|
||||||
|
|
||||||
d = [a - b for a, b in zip(v_local, v_pypi)] # diff
|
d = [a - b for a, b in zip(v_local, v_pypi)] # diff
|
||||||
increment = (d[0] == d[1] == 0) and (0 < d[2] < 3) # only publish if patch version increments by 1 or 2
|
|
||||||
|
increment_patch = (d[0] == d[1] == 0) and (0 < d[2] < 3) # publish if patch version increments by 1 or 2
|
||||||
|
increment_minor = (d[0] == 0) and (d[1] == 1) and v_local[2] == 0 # publish if minor version increments
|
||||||
|
|
||||||
|
increment = increment_patch or increment_minor
|
||||||
|
|
||||||
os.system(f'echo "increment={increment}" >> $GITHUB_OUTPUT')
|
os.system(f'echo "increment={increment}" >> $GITHUB_OUTPUT')
|
||||||
os.system(f'echo "version={ultralytics.__version__}" >> $GITHUB_OUTPUT')
|
os.system(f'echo "version={ultralytics.__version__}" >> $GITHUB_OUTPUT')
|
||||||
|
|
||||||
if increment:
|
if increment:
|
||||||
print('Local version is higher than PyPI version. Publishing new version to PyPI ✅.')
|
print('Local version is higher than PyPI version. Publishing new version to PyPI ✅.')
|
||||||
id: check_pypi
|
id: check_pypi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue