If you are attempting to deploy from GitLab CI, GitLab automatically creates a user and token combination that can be used to authenticate in the CI context under the user gitlab-ci-token
and the password in the $CI_JOB_TOKEN
variable.
All you need to do that is poetry specific is set the config values for poetry to know the package registry exists, then pass this for authentication. All of which can be done just in the CI config/script.
script:
- poetry build
- poetry config repositories.gitlab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
- poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
- poetry publish --repository gitlab
If you are deploying from outside of GitLab CI, then you would need that access token and to provide values as used in the script above.
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
– Dram