Skip to content

Commit

Permalink
handle all deploy logic in bash file
Browse files Browse the repository at this point in the history
  • Loading branch information
nihlaeth committed Feb 26, 2017
1 parent c366694 commit 1b28f9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
14 changes: 1 addition & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,7 @@ after_success:
- echo $PATH
- which bash
- which python
- HOME=$TRAVIS_BUILD_DIR TWINE_REPOSITORY=testpypi sh ./scripts/pypi_deploy.sh
deploy:
- provider: script
script: "HOME=$TRAVIS_BUILD_DIR TWINE_REPOSITORY=testpypi sh ./scripts/pypi_deploy.sh"
on:
condition: $TRAVIS_PYTHON_VERSION = "3.6"
skip_cleanup: true
- provider: script
script: "HOME=$TRAVIS_BUILD_DIR TWINE_REPOSITORY=pypi sh ./scripts/pypi_deploy.sh"
on:
tags: true
condition: $TRAVIS_PYTHON_VERSION = "3.6"
skip_cleanup: true
- test "${TRAVIS_PULL_REQUEST}" == "false" && sh ./scripts/pypi_deploy.sh
env:
global:
- TWINE_USERNAME=nihlaeth
Expand Down
15 changes: 5 additions & 10 deletions scripts/pypi_deploy.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/bash
set -ev
echo "check #1"
set +x # double-check that x is unset
echo "check #2"
# set +x # double-check that x is unset
$(which python) setup.py sdist bdist_wheel --universal
echo "check #3"
cat > ~/.pypirc << _EOF_
[distutils]
index-servers=
Expand All @@ -21,11 +18,9 @@ repository = https://upload.pypi.org/legacy/
username = ${TWINE_USERNAME}
password = ${TWINE_PASSWORD}
_EOF_
echo "check #4"
if [ "${TRAVIS_PYTHON_VERSION}" = "3.6" ]; then
$(which twine) upload -r ${TWINE_REPOSITORY} dist/*
$(which twine) upload -r testpypi --skip-existing dist/*
if [ "${TRAVIS_TAG}" != "" ]; then
$(which twine) upload -r pypi --skip-existing dist/*
fi
fi

# reset ownership so that we can stop using sudo
# sudo chown --changes --recursive $(whoami):$(id --group $(whoami)) .
# sudo chown --changes $(whoami):$(id --group $(whoami)) ~/.pypirc

0 comments on commit 1b28f9d

Please sign in to comment.