From d486ba1f83a044d7167c559d0ca8d1f7125ceee3 Mon Sep 17 00:00:00 2001 From: mguschin Date: Thu, 5 Mar 2026 21:12:39 +0300 Subject: [PATCH] chore: add semantic versioning and automatic changelog generation - Add cliff.toml config for git-cliff with conventional commit parsing - Create scripts/release.sh for automated version bumping - Generate CHANGELOG.md from git history with semver tags (v1.0.0, v1.7.2) - Release workflow: ./scripts/release.sh {major|minor|patch|VERSION} --- CHANGELOG.md | 21 +++++++++++-------- cliff.toml | 45 ++++++++++++++++++++++++++++++++++++++++ scripts/release.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 cliff.toml create mode 100755 scripts/release.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 806185d..afcbc50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,16 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.6.0] - 2025-06-15 +## [1.7.2] - 2026-03-05 -### Added -- Initial changelog implementation -- Version tracking system +### Other -### Changed -- Minor version bump from 1.5.2 to 1.6.0 +- Add user registration and auth web app +- Update docker-compose.yml: remove database service, adjust ports and host +- Integrate Bootstrap 5 and Bootstrap Icons into UI + +## [1.0.0] - 2026-02-02 + +### Other + +- Initial commit +- V1. -## [1.5.2] - Previous Release -### Notes -- Historical version before changelog implementation \ No newline at end of file diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..c8c21ab --- /dev/null +++ b/cliff.toml @@ -0,0 +1,45 @@ +[changelog] +header = """# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n +""" +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [Unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + - {% if commit.scope %}**{{ commit.scope }}**: {% endif %}\ + {{ commit.message | split(pat="\n") | first | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +trim = true +footer = "" + +[git] +conventional_commits = true +filter_unconventional = false +split_commits = false +commit_parsers = [ + { message = "^feat", group = "Added" }, + { message = "^fix", group = "Fixed" }, + { message = "^doc", group = "Documentation" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Changed" }, + { message = "^style", group = "Styling" }, + { message = "^test", group = "Testing" }, + { message = "^chore\\(release\\)", skip = true }, + { message = "^chore", group = "Miscellaneous" }, + { message = "^ci", group = "CI/CD" }, + { body = ".*security", group = "Security" }, + { message = ".*", group = "Other" }, +] +filter_commits = false +tag_pattern = "v[0-9].*" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..a0679d2 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Release script: bump version, generate changelog, commit, and tag. +# +# Usage: +# ./scripts/release.sh +# ./scripts/release.sh 2.0.0 # explicit version +# +set -euo pipefail + +VERSION_FILE="version" + +current_version=$(cat "$VERSION_FILE") +echo "Current version: $current_version" + +IFS='.' read -r major minor patch <<< "$current_version" + +case "${1:-}" in + major) new_version="$((major + 1)).0.0" ;; + minor) new_version="${major}.$((minor + 1)).0" ;; + patch) new_version="${major}.${minor}.$((patch + 1))" ;; + "") + echo "Usage: $0 " + exit 1 + ;; + *) + # Validate explicit semver + if [[ ! "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Error: '$1' is not a valid semver (X.Y.Z)" + exit 1 + fi + new_version="$1" + ;; +esac + +echo "Bumping to: $new_version" + +# Update version file +echo "$new_version" > "$VERSION_FILE" + +# Generate changelog +git-cliff --tag "v${new_version}" --output CHANGELOG.md + +# Commit and tag +git add "$VERSION_FILE" CHANGELOG.md +git commit -m "chore(release): v${new_version}" +git tag "v${new_version}" + +echo "" +echo "Released v${new_version}" +echo "Don't forget to push: git push && git push --tags"