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

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.0.5.tar.gz (9.8 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.0.5-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tag_creator-0.0.5.tar.gz
  • Upload date:
  • Size: 9.8 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.0.5.tar.gz
Algorithm Hash digest
SHA256 b1a0fd43abe7625e8fcad5c14214ffc53c7c67cba91ee0fe19a7408a75fb2ad0
MD5 9461ba9ba5c522197b5aa9de67261c70
BLAKE2b-256 5015a6d8698c0b3145eb48f96b3139b05f3e5212ed45f7ffdb57c5ce1781a350

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tag_creator-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0143920b7588e4b1052178d59710d998252acf657cdcc665cecb85c33a5016c4
MD5 7f6bc03784ea5ac2ec78166845bd5100
BLAKE2b-256 d6f200694d3acdbb431edf41f9c55c8dbf69ea4aa8ab430502165891b43ecccd

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