[travis] use twine to upload to PyPI

This commit is contained in:
Cosimo Lupo 2018-09-11 12:09:50 +02:00
parent 9424f61453
commit 056bd7d967
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482
4 changed files with 19 additions and 34 deletions

View File

@ -3,9 +3,10 @@ sudo: false
language: python
python: 3.5
# empty "env:" is needed for 'allow_failures'
# https://docs.travis-ci.com/user/customizing-the-build/#Rows-that-are-Allowed-to-Fail
env:
global:
- TWINE_USERNAME="anthrotype"
- secure: PJuCmlDuwnojiw3QuDhfNAaU4f/yeJcEcRzJAudA66bwZK7hvxV7Tiy9A17Bm6yO0HbJmmyjsIr8h2e7/PyY6QCaV8RqcMDkQ0UraU16pRsihp0giVXJoWscj2sCP4cNDOBVwSaGAX8yZ2OONc5srESywghzcy8xmgw6O+XFqx4=
matrix:
fast_finish: true
@ -73,9 +74,6 @@ script:
after_success:
- ./.travis/after_success.sh
before_deploy:
- ./.travis/before_deploy.sh
notifications:
irc: "irc.freenode.org##fonts"
email: fonttools-dev@googlegroups.com
@ -93,16 +91,3 @@ deploy:
repo: fonttools/fonttools
all_branches: true
condition: "$BUILD_DIST == true"
# deploy to PyPI on tags
- provider: pypi
server: https://upload.pypi.org/legacy/
user: anthrotype
password:
secure: DxAf1E0u4Xxe3+R9flkz69g84pfEQF2knDmKhZVzCJBbz9DUjuQlAWGZoAbn9kZIW0bq3yNIihVP5fjxgs0zKO7M4OCVRisVAgZDAZzsRo7awX9dBsyaTGt9WXvzVKCFPcehKI3lZ/fuPvovY+Dl4c91F5qfkh0pY6OKy9uDj3k=
skip_cleanup: true
distributions: pass
on:
tags: true
repo: fonttools/fonttools
all_branches: true
condition: "$BUILD_DIST == true"

View File

@ -9,3 +9,8 @@ fi
# upload coverage data to Codecov.io
[[ ${TOXENV} == *"-cov"* ]] && tox -e codecov
# if tagged commit, create distribution packages and deploy to PyPI
if [ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_REPO_SLUG" == "fonttools/fonttools" ] && [ "$BUILD_DIST" == true ]; then
tox -e pypi
fi

View File

@ -1,15 +0,0 @@
#!/bin/bash
set -e
set -x
# build sdist and wheel distribution packages in ./dist folder.
# Travis runs the `before_deploy` stage before each deployment, but
# we only want to build them once, as we want to use the same
# files for both Github and PyPI
if $(ls ./dist/fonttools*.zip > /dev/null 2>&1) && \
$(ls ./dist/fonttools*.whl > /dev/null 2>&1); then
echo "Distribution packages already exists; skipping"
else
tox -e bdist
fi

12
tox.ini
View File

@ -52,9 +52,19 @@ commands =
# check metadata and rst long_description
python setup.py check --restructuredtext --strict
# clean up build/ and dist/ folders
rm -rf {toxinidir}/dist
python -c 'import shutil; shutil.rmtree("dist", ignore_errors=True)'
python setup.py clean --all
# build sdist
python setup.py sdist --dist-dir {toxinidir}/dist
# build wheel from sdist
pip wheel -v --no-deps --no-index --wheel-dir {toxinidir}/dist --find-links {toxinidir}/dist fonttools
[testenv:pypi]
deps =
{[testenv:bdist]deps}
twine
skip_install = true
passenv = TWINE_USERNAME TWINE_PASSWORD
commands =
{[testenv:bdist]commands}
twine upload dist/*.whl dist/*.zip