I’m having trouble getting authentication to PyPI working when uploading. TWINE_USERNAME and TWINE_PASSWORD are defined in the GitLab CI/CD variable settings. I can get this to work using the same commands locally but when using them in the pipeline it returns a 403 Forbidden error. I am using token authentication and setting the username as __token__ as described in the documentation. I know the credentials are good because when I try to use them locally the package uploads fine. Just not sure what else to try. Any help or ideas would be much appreciated.
Relevant gitlab-ci.yml portion:
- pip install twine build
- python -m build
- python -m twine upload dist/*
HTTPError: 403 Forbidden from upload.pypi.org · PyPI
Invalid or non-existent authentication information. See
Help · PyPI for more information.