TravisCI 部署找不到 setup.py

TravisCI deploy cannot find setup.py

设置我的 python 项目(在 GitHub 上)到 PyPi 的自动发布应该相当容易:https://docs.travis-ci.com/user/deployment/pypi/

所以,我在 .travis.yml 中添加了以下内容:

deploy:
  provider: pypi
  user: DanHickstein
  on:
    tags: true
  password:
    secure: GHhpt4Ssv2VQh6...

它几乎可以工作,但我收到以下 TravisCI 错误:

Preparing deploy
Authenticated as DanHickstein

Deploying application
python: can't open file 'setup.py': [Errno 2] No such file or directory
ValueError: Cannot find file (or expand pattern): 'dist/*'
python: can't open file 'setup.py': [Errno 2] No such file or directory

我不明白为什么找不到 setup.py。它就在与 .travis.yml...

相同的目录中

问题是install阶段的following line

- cd ~/

确保在部署之前回到项目目录的根目录,可能在 before_deploy 阶段。