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}
This commit is contained in:
mguschin
2026-03-05 21:12:39 +03:00
parent bd0ff8f449
commit d486ba1f83
3 changed files with 108 additions and 9 deletions

View File

@@ -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/), 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). 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 ### Other
- Initial changelog implementation
- Version tracking system
### Changed - Add user registration and auth web app
- Minor version bump from 1.5.2 to 1.6.0 - 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

45
cliff.toml Normal file
View File

@@ -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].*"

51
scripts/release.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# Release script: bump version, generate changelog, commit, and tag.
#
# Usage:
# ./scripts/release.sh <major|minor|patch>
# ./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 <major|minor|patch|VERSION>"
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"