brunabxs / gitlab-changelog

A simple python script that should be called by Gitlab runners to create new project versions automatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gitlab changelog

Build Status

This project aims to help developers to generate incremental versions for a project automatically by Gitlab CI.

Requirements

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.

Usage

  1. Copy ci_helper.py file to the root of your project.
  2. Generate a SSH key.
  3. 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.
  4. Add a Deploy key with the SSH public key.
  5. Update your .gitlab-ci.yml to execute ci_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.

About

A simple python script that should be called by Gitlab runners to create new project versions automatically


Languages

Language:Python 100.0%