Skip to content

Commit

Permalink
fix(pypi): get ci env
Browse files Browse the repository at this point in the history
  • Loading branch information
NewFuture committed May 1, 2019
1 parent 36c4636 commit ca7ffcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ deploy:
- provider: pypi
user: newfuture
password: "${PYPI_PWD}"
skip_cleanup: false
distributions: "sdist bdist_wheel" # Your distributions here
on:
tags: true
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
long_description = f.read()

# Get version from environment vars
if hasattr(environ,'TRAVIS_TAG'):
version = environ['TRAVIS_TAG'] # `TRAVIS_TAG` from Travis
elif hasattr(environ,'BUILD_SOURCEBRANCHNAME'):
version = environ['BUILD_SOURCEBRANCHNAME'] # `BUILD_SOURCEBRANCHNAME` from azure pipelines
if 'TRAVIS_TAG' in environ:
version = environ['TRAVIS_TAG'] # `TRAVIS_TAG` from Travis
elif 'BUILD_SOURCEBRANCHNAME' in environ:
version = environ['BUILD_SOURCEBRANCHNAME'] # from azure pipelines
else:
raise Exception("This setup script should be run in CI/CD environment (TravisCI or AzurePipelines)")
raise Exception("setup.py should be run in CI (Travis or AzurePipelines)")
version = version.strip('v').strip('V')

# Arguments marked as "Required" below must be included for upload to PyPI.
Expand Down

0 comments on commit ca7ffcc

Please sign in to comment.