I'm trying to upload a package to pypi using a Gitlab CI job, but I cannot make it work :/ Anyone has a working example?
What I have tried so far in my .gitlab-ci.yaml
(from my local machine all of them are working):
Twine with a
.pypirc
file- 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
Same as before but with
$VARIABLE
[...] - 'echo "username: $PYPI_USER" >> ~/.pypirc' - 'echo "password: $PYPI_PASSWORD" >> ~/.pypirc' [...]
Two options before but using
python setup.py ... upload
twine upload dist/* -u $PYPI_USER -p $PYPI_PASSWORD
twine upload dist/*
wihtTWINE_USERNAME
andTWINE_PASSWORD
environment variables.
... and always get a 403 Client Error: Invalid or non-existent authentication information
. I'm running out of options...
PYPI_USER
andPYPI_PASSWORD
? – TawnyatawshaSettings
>CI/CD
>Secret variables
(as protected, for the same branches I am running these jobs). – SomethingCI_JOB_TOKEN
is now (Sept. 2020, GitLab 13.4) possible. See my revised answer below. – Kweiyang