Skip to main content

Automatically create git release tags based on a merged commit message and previous tag.

Project description

Tag creator

Tag Creator is a Python tool that automatically generates release tags follow SemVer conventions. It's designed to streamline the process of creating version tags for software projects, ensuring consistency and saving time. Each new release tag will be created based on the latest tag version for the provided git branch. Increments for new version will be parsed from the commit message. Commit messages must follow the Conventional Commits format.

Each commit must start from the allowed type to find increments for next tag based on it. Be avare that the MAJOR verion rule is differnt. Commits still can start from the allowed types in the MAJOR section, however there are several additional rules:

  • script will interpret commits with the ! character after the allowed type as a major verion
  • allowed type can be declared in a description. E.g.:
fix: some fix

BREAKING CHANGE: this is a breaking change!

Initial list of types in the configuration provided by conventional-changelog.

Features

  • Automatically generates release tags
  • Easy integration into existing workflows
  • Lightweight and configurable

Examples

Use --help option to see available scripts arguments.

Show the latest tag for branch

Since project tags have the v prefix before versions, --tag_prefix="v" argument passed.

python -m tag_creator --current_version --release_branch="main" --tag_prefix="v"
__main__ INFO: Current tag: v0.0.3 Branch: main

Internal command to search a tag will be: git -C . tag --merged 'main' --sort=creatordate --list 'v[0-9]*\.[0-9]*\.[0-9]*'.

Create new release tag

To create new tag with push to remote use --create_new_tag argument. Add --dry_run argument if you do not need to update your remote.

python -m tag_creator --create_new_tag --tag_prefix="v" --release_branch="main"

version INFO: Current version is: v0.0.4
14:36:01 version INFO: Determine increments for new tag based on commit (MR) msg: docs: foo-bar

version INFO: New tag will be created and pushed. Tag: v0.0.5, message Automatically created tag

To create new tag from the bunch of commits, e.g. in case of merge not squashed merge request, use --start_from option. It allows to parse all commits from the specified version to current HEAD and select the highest increment, based on commit messages. Be aware, that only current HEAD are not allowed to contain a tag!

See your CI preferences to obtain a commit before your merge.

See or change the configuration

You can provide a custom configuration file to change the default majority-to-type match to change the script behaviour. Default configuration file is located here Be aware that configs will not be joined when you provide new config file.

See default config:

python -m tag_creator --show_config

__main__ INFO: commit_types:
- majority: major
  type:
  - BREAKING_CHANGE
  - BREAKING CHANGE
- majority: minor
  type:
  - feat
  - build
  - ci
  - revert
- majority: patch
  type:
  - fix
  - docs
  - refactor
  - perf
  - test
  - chore
  - style

Update config (follow the same structure as in the default configuration file):

python -m tag_creator --config="$HOME/custom_cfg.yml" --show_config
configuration INFO: Custom config read!
__main__ INFO: commit_types:
- majority: major
  type:
  - major
- majority: minor
  type:
  - minor
- majority: patch
  type:
  - patch

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tag_creator-0.1.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tag_creator-0.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file tag_creator-0.1.1.tar.gz.

File metadata

  • Download URL: tag_creator-0.1.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for tag_creator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a4f04c363092304ca4a07b99f8bd103984eb773cbef4ceaabc9257f62e2f7ef
MD5 72cfe075b870321a96521d23b792b036
BLAKE2b-256 95ddf4ece93384c52bb7a7787c7a0807e7ca0ad2c6685e46f0f2f72044915a1f

See more details on using hashes here.

File details

Details for the file tag_creator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tag_creator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for tag_creator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17935338e6e6564e1850f37e006da3aaad82f3f1a46f29760115dce575bb2c4a
MD5 58e2c266bcaf1171e2cf1835d0e0ba0a
BLAKE2b-256 b6f207993f4a9ab52ca393c81a22e7a73860e0497fd2c83c22fbc113b9fe13b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page