fix(pypi): get ci env

This commit is contained in:
New
2019-05-02 01:26:00 +08:00
parent 36c463652d
commit ca7ffcc9fe
2 changed files with 6 additions and 5 deletions
+1
View File
@@ -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
+5 -5
View File
@@ -24,12 +24,12 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f:
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.