在AppVeyor上的部署脚本中,我使用ps: >-
命令根据repo分支进行部署:
- ps: >-
If ($env:APPVEYOR_REPO_BRANCH -eq 'devel') {
echo not deploying on devel # twine upload --skip-existing -r test dist/*
}
ElseIf ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {
twine upload --skip-existing dist/*
}
Else {
echo not deploying on other branches
}
这将在AppVeyor构建上创建错误消息,如下所示:
twine :
At line:2 char:5
+ twine upload --skip-existing dist/*
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
并且构建显示为失败。奇怪的是,这些软件包已上传到pypi并可供下载。因此,该命令实际上执行得很好,但是由于此异常,构建显示为失败。如果仅错误消息会提供更多信息...
下面是使用更简单的脚本以及完整的输出运行的结果,如AppVeyor(https://ci.appveyor.com/project/mzwiessele/gpy/build/1.0.361/job/baimi4og179tk3p8)所示
if ($env:APPVEYOR_REPO_BRANCH -eq 'deploy') {
twine upload --skip-existing dist/*
} else {
echo not deploying on other branches
}
twine :
At line:2 char:5
+ twine upload --skip-existing dist/*
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
0%| | 0.00/1.21M [00:00<?, ?bytes/s]
1%| | 8.19K/1.21M [00:00<00:21, 56.1Kbytes/s]
8%|8 | 98.3K/1.21M [00:00<00:14, 77.6Kbytes/s]
33%|###3 | 401K/1.21M [00:00<00:07, 109Kbytes/s]
0%| | 0.00/1.43M [00:00<?, ?bytes/s]
Uploading distributions to https://upload.pypi.org/legacy/
Uploading GPy-1.7.6-cp27-cp27m-win_amd64.whl
Uploading GPy-1.7.6.win-amd64-py2.7.exe
Command executed with exception:
最佳答案
发生这种情况是因为twine
将输出写入StdErr,而任何输出到StdErr的输出都被PowerShell主机视为RemoteException
。尝试将该PS命令重写为批处理文件。