我正在尝试使用 Gitlab CI 作业将包上传到 pypi,但我无法使其工作:/ 有人有工作示例吗?
到目前为止我在我的.gitlab-ci.yaml
(从我的本地机器上所有的都在工作)中尝试过的东西:
用
.pypirc
文件缠绕- echo "[distutils]" >> ~/.pypirc - echo "index-servers =" >> ~/.pypirc - echo " pypi" >> ~/.pypirc - echo "" >> ~/.pypirc - echo "[pypi]" >> ~/.pypirc - 'echo "repository: https://upload.pypi.org/legacy/" >> ~/.pypirc' - 'echo "username: ${PYPI_USER}" >> ~/.pypirc' - 'echo "password: ${PYPI_PASSWORD}" >> ~/.pypirc' - python3 setup.py check sdist bdist # This will fail if your creds are bad. - cat ~/.pypirc - twine upload dist/* --config-file ~/.pypirc
和以前一样,但有
$VARIABLE
[...] - 'echo "username: $PYPI_USER" >> ~/.pypirc' - 'echo "password: $PYPI_PASSWORD" >> ~/.pypirc' [...]
之前的两个选项,但使用
python setup.py ... upload
twine upload dist/* -u $PYPI_USER -p $PYPI_PASSWORD
twine upload dist/*
TWINE_USERNAME
和TWINE_PASSWORD
环境变量。
...并且总是得到一个403 Client Error: Invalid or non-existent authentication information
. 我的选择已经不多了...