Find version automatically based on git tags and commit messages.

Overview

GIT-CONVENTIONAL-VERSION

Find version automatically based on git tags and commit messages.

The tool is very specific in its function, so it is very flexible.

You can use it as a part of many different integrations and it will not break your process.

Install

python3 -m pip install git-conventional-version

Usage

Get new bumped final version:

gcv

Get new bumped release candidate version:

gcv --type=rc

Get current (old) version, 0.0.0 if none exists:

gcv --old

Example of CI automation script:

old=$(gcv --old)
new=$(gcv)
# check if version bump would happen
if [ ! $new == $old ]; then
    # if yes, update setup.cfg
    sed -i "s/^version.*/version = $new/g" setup.cfg
    # and commit release
    git add setup.cfg
    git commit -m "$new"
    git tag "$new"
    git push --tags
    git push
fi

Version formats

Tags are equivalent to versions, no suffix or prefix is added or interpreted. Formats follow https://www.python.org/dev/peps/pep-0440/.

  • Final version

Standard tag is in the format \d+\.\d+\.d+ ie. 1.0.0. It can be divided into major . minor . patch versions.

It is automatically bumped based on commits messages and old version of the same type (look at Git commit message convention below).

  • Pre-release versions

Pre-release versions bumps are calculated based on last final version, its expected bump and old version of the same pre-release type.

    • Release candidate version

Format \d+\.\d+\.d+rc\d+ ie. 1.0.0rc1.

    • Developmental version

Format \d+\.\d+\.d+dev\d+ ie. 1.0.0dev1.

  • Local version

Also, local version can be created from commit sha and old version: \d+\.\d+\.d\+.+ ie. 0.0.0+79ad.

Git commit message convention

Convention is based on https://www.conventionalcommits.org/en/v1.0.0/ (it's good!). At the moment, only the following rules apply (I usually use only these but more can be added easily):

  • Start commit with 'fix:' or 'fix(.*):' to bump patch version.
  • Start commit with 'feat:' or 'feat(.*):' to bump minor version.
  • Include in the commit line with 'breaking change:' to bump major version.

Notices

Automatically handling many types of version tags in git is more complicated than it initially seems like.

You might also like...
Python code to generate and store certificates automatically , using names from a csv file

WOC-certificate-generator Python code to generate and store certificates automatically , using names from a csv file IMPORTANT In order to make the co

Python script to launch burp scans automatically

SimpleAutoBurp Python script that takes a config.json file as config and uses Burp Suite Pro to scan a list of websites.

Automatically Generate Rulesets for IIS for Intelligent HTTP/S C2 Redirection

Automatically Generate Rulesets for IIS for Intelligent HTTP/S C2 Redirection This project converts a Cobalt Strike profile to a functional web.config

Python utilities for writing cross-version compatible libraries

Python utilities for writing cross-version compatible libraries

Create C bindings for python automatically with the help of libclang

Python C Import Dynamic library + header + ctypes = Module like object! Create C bindings for python automatically with the help of libclang. Examples

An awesome tool to save articles from RSS feed to Pocket automatically.
An awesome tool to save articles from RSS feed to Pocket automatically.

RSS2Pocket An awesome tool to save articles from RSS feed to Pocket automatically. About the Project I used to use IFTTT to save articles from RSS fee

Nmap script to guess* a GitLab version.

gitlab-version-nse Nmap script to guess* a GitLab version. Usage https://github.com/righel/gitlab-version-nse cd gitlab-version-nse nmap target --s

Early version for manipulate Geo localization data trough API REST.

Backend para obtener los datos (beta) Descripción El servidor está diseñado para recibir y almacenar datos enviados en forma de JSON por una aplicació

This program organizes automatically files in folders named as file's extension

Auto Sorting System by Sergiy Grimoldi - V.0.0.2 This program organizes automatically files in folders named as file's extension How to use the code T

Comments
  • Fix tag comparison (numerical order)

    Fix tag comparison (numerical order)

    Tag comparison was done using alphabetical ordering instead of numerical ordering. This won't work for releases that uses numbers over 9. Casting each version component to an int will force numerical ordering.

    The bug can easily be reproduced by creating a dummy repository and adding tags "0.9.0" and "0.10.0". "0.9.0"will be seen as the latest by error.

    opened by sgrimard 0
Owner
DevOps Enthusiast
A small python tool to get relevant values from SRI invoices

SriInvoiceProcessing A small python tool to get relevant values from SRI invoices Some useful info to run the tool Login into your SRI account and ret

Wladymir Brborich 2 Jan 07, 2022
A simple python script to generate an iCalendar file for the university classes.

iCal Generator This is a simple python script to generate an iCalendar file for the university classes. Installation Clone the repository git clone ht

Foad Rashidi 2 Sep 01, 2022
A Python package implementing various colour checker detection algorithms and related utilities.

A Python package implementing various colour checker detection algorithms and related utilities.

colour-science 147 Dec 29, 2022
Minimal Windows system information tool written in Python

wfetch wfetch is a Minimal Windows system information tool written in Python (Only works on Windows) Installation First of all have python installed.

zJairO 3 Jan 24, 2022
Various importers for cointracker

cointracker_importers Various importers for cointracker To convert nexo .csv format to cointracker .csv format: Download nexo csv file. run python Nex

Stefanos Anastasiou 9 Oct 24, 2022
Give you a better view of your Docker registry disk usage.

registry-du Give you a better view of your Docker registry disk usage. This small tool will analysis your Docker registry(vanilla or Harbor both work)

Nova Kwok 16 Jan 07, 2023
Regression Metrics Calculation Made easy

Regression Metrics Mean Absolute Error Mean Square Error Root Mean Square Error Root Mean Square Logarithmic Error Root Mean Square Logarithmic Error

Ashish Patel 12 Jan 02, 2023
Tool for generating Memory.scan() compatible instruction search patterns

scanpat Tool for generating Frida Memory.scan() compatible instruction search patterns. Powered by r2. Examples $ ./scanpat.py arm.ks:64 'sub sp, sp,

Ole André Vadla Ravnås 13 Sep 19, 2022
A simple gpsd client and python library.

gpsdclient A small and simple gpsd client and library Installation Needs Python 3 (no other dependencies). If you want to use the library, use pip: pi

Thomas Feldmann 33 Nov 24, 2022
It is a tool that looks for a specific username in social networks

It is a tool that looks for a specific username in social networks

MasterBurnt 6 Oct 07, 2022
a simple function that randomly generates and applies console text colors

ChangeConsoleTextColour a simple function that randomly generates and applies console text colors This repository corresponds to my Python Functions f

Mariya 6 Sep 20, 2022
Python @deprecat decorator to deprecate old python classes, functions or methods.

deprecat Decorator Python @deprecat decorator to deprecate old python classes, functions or methods. Installation pip install deprecat Usage To use th

12 Dec 12, 2022
Automatic generator of readmes for git repositories (Includes file' listing)

Readme Generator We are bored of write the same things once and once again. We trust in the comments made inside of our files, and we decided to autom

Natalia Vera Duran 6 Jul 20, 2021
Manage your exceptions in Python like a PRO

A linter to manage all your python exceptions and try/except blocks (limited only for those who like dinosaurs).

Guilherme Latrova 353 Dec 31, 2022
A tool to create the basics of a project

Project-Scheduler Instalação Para instalar o Project Maker, você necessita está em um ambiente de desenvolvimento Linux ou wsl com alguma distro debia

2 Dec 17, 2021
JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python🚀

Pure Python JavaScript Translator/Interpreter Everything is done in 100% pure Python so it's extremely easy to install and use. Supports Python 2 & 3.

Piotr Dabkowski 2.1k Dec 30, 2022
About Library for extract infomation from thai personal identity card.

ThaiPersonalCardExtract Library for extract infomation from thai personal identity card. imprement from easyocr and tesseract New Feature v1.3.2 🎁 In

ggafiled 26 Nov 15, 2022
A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use that mirror

Kali Mirror Finder Using Single Python File A python package for your Kali Linux distro that find the fastest mirror and configure your apt to use tha

MrSingh 6 Dec 12, 2022
Python 3 script unpacking statically x86 CryptOne packer.

Python 3 script unpacking statically x86 CryptOne packer. CryptOne versions: 2021/08 until now (2021/12)

5 Feb 23, 2022
Local backup made easy, with Python and shutil

KTBackup BETA Local backup made easy, with Python and shutil Features One-command backup and restore Minimalistic (only using stdlib) Convenient direc

kelptaken 1 Dec 27, 2021