Updated config.yml

This commit is contained in:
Krish Dholakia 2023-10-06 06:32:33 -07:00
parent a977e94a5d
commit 3612386603

View file

@ -80,25 +80,29 @@ jobs:
- run: - run:
name: PyPI publish name: PyPI publish
command: | command: |
if [ -n "$(git diff --name-only $CIRCLE_SHA1^..$CIRCLE_SHA1 | grep 'pyproject.toml')" ]; then echo "Install TOML package."
echo "pyproject.toml modified" python -m pip install toml
echo -e "[pypi]\nusername = __token__\npassword = $PYPI_API_TOKEN" > ~/.pypirc VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
python -m pip install --upgrade pip PACKAGE_NAME=$(python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['name'])")
pip install build if ! pip show -v $PACKAGE_NAME | grep -q "Version: ${VERSION}"; then
pip install wheel echo "pyproject.toml modified"
pip install --upgrade twine setuptools echo -e "[pypi]\nusername = __token__\npassword = $PYPI_API_TOKEN" > ~/.pypirc
rm -rf build dist python -m pip install --upgrade pip
pip install build
pip install wheel
pip install --upgrade twine setuptools
rm -rf build dist
echo "Building package" echo "Building package"
python -m build python -m build
echo "Twine upload to dist" echo "Twine upload to dist"
echo "Contents of dist directory:" echo "Contents of dist directory:"
ls dist/ ls dist/
twine upload --verbose dist/* twine upload --verbose dist/*
else else
echo "No changes to pyproject.toml. Skipping PyPI publish." echo "Version ${VERSION} of package is already published on PyPI. Skipping PyPI publish."
circleci step halt circleci step halt
fi fi
workflows: workflows: