Update config.yml

This commit is contained in:
Ishaan Jaff 2023-08-01 16:06:31 -07:00 committed by GitHub
parent b040dd1349
commit 400c8158ab

View file

@ -30,19 +30,24 @@ jobs:
working_directory: ~/project working_directory: ~/project
environment: environment:
TWINE_USERNAME: __token__
TWINE_PASSWORD: $PYPI_API_TOKEN
PYPI_API_TOKEN: $PYPI_API_TOKEN # Use the environment variable in the job PYPI_API_TOKEN: $PYPI_API_TOKEN # Use the environment variable in the job
steps: steps:
- checkout - checkout
# Check if setup.py is modified and publish to PyPI # Check if setup.py is modified and publish to PyPI
- run: - run:
name: Check setup.py modification name: PyPI publish
command: | command: |
if [ -n "$(git diff --name-only $CIRCLE_SHA1^..$CIRCLE_SHA1 | grep 'setup.py')" ]; then if [ -n "$(git diff --name-only $CIRCLE_SHA1^..$CIRCLE_SHA1 | grep 'setup.py')" ]; then
echo "Creating a PyPI token file..." echo "setup.py modified"
echo -e "[pypi]\nusername = __token__\npassword = $PYPI_API_TOKEN" > ~/.pypirc echo -e "[pypi]\nusername = __token__\npassword = $PYPI_API_TOKEN" > ~/.pypirc
python setup.py sdist python -m pip install --upgrade pip
python -m pip install --upgrade twine pip install twine
pip install wheel
pip install --upgrade setuptools
python setup.py sdist bdist_wheel
twine upload dist/* twine upload dist/*
else else
echo "No changes to setup.py. Skipping PyPI publish." echo "No changes to setup.py. Skipping PyPI publish."