Skip to content
Snippets Groups Projects
Commit 8a1d9d4c authored by Daniel Dehennin's avatar Daniel Dehennin
Browse files

feat(python): upload python package files with `twine`

parent 6b6a59f2
No related branches found
No related tags found
No related merge requests found
......@@ -167,6 +167,63 @@
- echo -e "\e[0Ksection_end:`date +%s`:python-build-wheel\r\e[0K"
#
# .python:upload
# ==============
#
# Upload python package files to the registry
#
# USAGE
# =====
#
# include:
# - project: EOLE/Infra/ci-tools
# ref: stable
# file: /templates/Python.yaml
#
# stages:
# - build
#
# python:upload {extends: '.python:upload'}
#
# REQUIREMENTS
# ============
#
# - a `build` stage must be present in your pipeline or it must be
# overriden by the extending job to feet your need
#
# - the `.on-release-tag` rules templates
#
# OPTIONAL VARIABLES
# ==================
#
# - `PYTHON_DIST_FILES`: files to upload, defaults to `dist/*'
#
# - `PYTHON_SOURCE_DIR`: top level directory of python source where to
# find `setup.py`, defaults to `.`
#
# - `PYTHON_REPOSITORY_URL`: pypi repository URL, defaults to
# `${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi`
#
# - `PYTHON_IMAGE`: name of the python docker image to use
#
.python:upload:
stage: release
extends: .python:base
variables:
PYTHON_REPOSITORY_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
script:
- echo -e "\e[0Ksection_start:`date +%s`:python-twine-upload\r\e[0KUpload '${PYTHON_SOURCE_DIR}/${PYTHON_DIST_FILES}' to repository '${PYTHON_REPOSITORY_URL}'"
- cd ${PYTHON_SOURCE_DIR}
- pip install twine
- 'TWINE_PASSWORD=${CI_JOB_TOKEN}
TWINE_USERNAME=gitlab-ci-token
python -m twine upload
--repository-url ${PYTHON_REPOSITORY_URL}
${PYTHON_DIST_FILES}'
- echo -e "\e[0Ksection_end:`date +%s`:python-twine-upload\r\e[0K"
#
# .python:base
# ============
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment