feat: pipeline for autopublish
PyPI Release Pipeline for GitLab
This GitLab pipeline is designed to automate the process of creating a new PyPI release whenever a new tag is pushed. The pipeline is composed of three stages: install
, build
, and upload
.
Prerequisites
- You should have the necessary permissions to push tags and execute pipelines in your GitLab repository.
- You should have a PyPI account with the necessary permissions to upload packages. The username and password should be stored in the
PYPI_USERNAME
andPYPI_PASSWORD
GitLab CI/CD variables.
Pipeline Stages
-
Install: Installs the necessary dependencies (
twine
,wheel
,setuptools-odoo
) into a Python virtual environment. -
Build: Prepares each modified Odoo module for PyPI release by generating
setup.py
files, builds the distribution files for these modules. -
Upload: Uploads the distribution files to PyPI.
Configuration
-
The pipeline uses the gitlab CI/CD variables
GIT_MAIL
andGIT_NAME
in theprepare
job script. These are used to set the Git user email and name for the commits made by thesetuptools-odoo-make-default
command. -
The pipeline uses the GitLab CI/CD variables
PYPI_NAME
andPYPI_TOKEN
to authenticate with PyPI during theupload
job. These should be set to your PyPI username and password.
Behavior
The pipeline only runs when a new tag is pushed to the repository. For each Odoo module that has been modified in the commit associated with the tag, it generates setup.py
files, builds the distribution files, and uploads them to PyPI. This means that only modified modules will get new PyPI releases.
Note
This pipeline assumes that each Odoo module resides in its own directory at the root level of the repository. If your repository's structure is different, you might need to adjust the script accordingly.