If source is newer than pypi, exit 0 and continue pipeline

This commit is contained in:
2022-11-25 00:33:22 +01:00
parent fa59acfd03
commit 2f716e65a3
2 changed files with 30 additions and 5 deletions

View File

@@ -38,14 +38,19 @@ platform:
arch: amd64
steps:
- name: Newer version to publish?
image: python:3.10
commands:
- bash publish_version?.sh
- name: Test PyPi publish
image: python:3.10
commands:
- make dist
- pip3 install -r requirements.txt
- pip3 install twine
- twine check dist/*
- twine upload --repository delugeClient-kevin dist/*
- make dist
- pip3 install -r requirements.txt
- pip3 install twine
- twine check dist/*
- twine upload --repository delugeClient-kevin dist/*
- name: PyPi publish
image: python:3.10

20
publish_version?.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/bash
PYPI_VERSION=$(pip3 show delugeClient-kevin | awk '$1 ~ /Version:/ { print $2 }')
SOURCE_VERSION=$(python3 delugeClient/__version__.py)
echo "hello"
echo "pypi version: $PYPI_VERSION"
echo "source version: $SOURCE_VERSION"
function version {
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
}
if [ $(version $SOURCE_VERSION) -gt $(version $PYPI_VERSION) ]; then
echo "source is newer than pypi"
exit 0
else
exit 1
echo "source is same or oldre, but not newer"
fi