This project aims to help developers to generate incremental versions for a project automatically by Gitlab CI.
It is very important to notice that your project CI must be written in Python 3.5+, otherwise the script will fail.
You will also need a Personal Access Token to retrieve information from your commits to generate the changelog. This article shows how to create a Personal Access Token.
- Copy
ci_helper.py
file to the root of your project. - Generate a SSH key.
- Create environment variables:
- GITLAB_API_ENDPOINT (optional): Must contain the Gitlab endpoint. Do not use / at the end. (e.g.: https://gitlab.com).
- GITLAB_PERSONAL_ACCESS_TOKEN (optional): Must contain your Personal Access Token.
- SSH_PRIVATE_KEY: Must contain the SSH private key if you are using GitLab shared runners.
- Add a Deploy key with the SSH public key.
- Update your
.gitlab-ci.yml
to executeci_helper.py
when a commit is made:
...
script:
- python ci_helper.py "${GITLAB_API_ENDPOINT}" "${GITLAB_PERSONAL_ACCESS_TOKEN}" "${CI_PROJECT_ID}" "${CI_COMMIT_SHA}"
...
Note: You can use .gitlab-ci.example.yml
as an example.