From a5b1854956c220064d859ff47596e495c59d1a58 Mon Sep 17 00:00:00 2001 From: Simon Diesenreiter Date: Sat, 30 Nov 2024 20:05:52 +0100 Subject: [PATCH] feat(concom): fix tag generation ref: NOISSUE --- .gitea/conventional_commits/commit-msg | 2 +- .../conventional_commits/generate-version.sh | 16 ++-- HISTORY.md | 94 +++++++++++++++++++ Makefile | 9 +- 4 files changed, 106 insertions(+), 15 deletions(-) diff --git a/.gitea/conventional_commits/commit-msg b/.gitea/conventional_commits/commit-msg index c262f41..b587009 100755 --- a/.gitea/conventional_commits/commit-msg +++ b/.gitea/conventional_commits/commit-msg @@ -7,7 +7,7 @@ echo "Running commit message checks..." # Get the commit message commit="$(cat .git/COMMIT_EDITMSG)" # Define the conventional commit regex -regex="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!?):\s(.+)\s((ref(s?):?\s?)[A-Z0-9]+\-[0-9]+)$" +regex="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!?):\s([a-zA-Z0-9-_!\&\.\%\"\'\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE)))$" # Check if the commit message matches the conventional commit format diff --git a/.gitea/conventional_commits/generate-version.sh b/.gitea/conventional_commits/generate-version.sh index c11c908..cf8893a 100755 --- a/.gitea/conventional_commits/generate-version.sh +++ b/.gitea/conventional_commits/generate-version.sh @@ -5,10 +5,7 @@ # minor: feat, style # patch: build, fix, perf, refactor, revert -GENERATE_VERSION=$1 -echo "Generate version: $GENERATE_VERSION" - -PREVENT_REMOVE_FILE=$2 +PREVENT_REMOVE_FILE=$1 TEMP_FILE_PATH=.gitea/conventional_commits/tmp LAST_TAG=$(git describe --tags --abbrev=0 --always) @@ -65,7 +62,7 @@ start() { increment_type="" while read message; do - if [[ $message =~ (([a-z]+)(\(.+\))?\!:)|(BREAKING CHANGE:) ]]; then + if [[ $message =~ (([a-zA-Z]+)(\(.+\))?\!:)|(BREAKING CHANGE:) ]]; then increment_type="major" break elif [[ $message =~ (^(feat|style)(\(.+\))?:) ]]; then @@ -82,7 +79,14 @@ start() { if [ -n "$increment_type" ]; then new_version=$(increment_version $LAST_TAG $increment_type) echo "New version: $new_version" - push_newversion $new_version + + gitchangelog | grep -v "[rR]elease:" > HISTORY.md + git add DotnetTestLib/VERSION HISTORY.md + git commit -m "release: version $(cat DotnetTestLib/VERSION) 🚀" + echo "creating git tag : $(cat DotnetTestLib/VERSION)" + git tag $(cat DotnetTestLib/VERSION) + git push -u origin HEAD --tags + echo "Gitea Actions will detect the new tag and release the new version." else echo "No changes requiring a version increment." fi diff --git a/HISTORY.md b/HISTORY.md index e69de29..7b00d82 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -0,0 +1,94 @@ +Changelog +========= + + +(unreleased) +------------ +- Ci: add conventional commit support ref: NOISSUE. [Simon Diesenreiter] +- Fix conflict. [Simon Diesenreiter] + + +0.1.17 (2024-11-28) +------------------- +- Fix auth. [Simon Diesenreiter] + + +0.1.16 (2024-11-28) +------------------- + + +0.1.15 (2024-11-28) +------------------- + + +0.1.14 (2024-11-28) +------------------- + + +0.1.13 (2024-11-28) +------------------- +- Another fix 3.0. [Simon Diesenreiter] + + +0.1.12 (2024-11-28) +------------------- + + +0.1.11 (2024-11-28) +------------------- +- Another fix 2.0. [Simon Diesenreiter] + + +0.1.10 (2024-11-28) +------------------- +- Another fix. [Simon Diesenreiter] + + +0.1.9 (2024-11-27) +------------------ +- Package source fix. [Simon Diesenreiter] + + +0.1.8 (2024-11-27) +------------------ +- More fixes. [Simon Diesenreiter] + + +0.1.7 (2024-11-27) +------------------ +- Fixed it. [Simon Diesenreiter] + + +0.1.6 (2024-11-27) +------------------ +- Test. [Simon Diesenreiter] + + +0.1.5 (2024-11-27) +------------------ +- Woohoo. [Simon Diesenreiter] + + +0.1.4 (2024-11-27) +------------------ +- Fix bug. [Simon Diesenreiter] + + +0.1.3 (2024-11-27) +------------------ + + +0.1.2 (2024-11-27) +------------------ +- More bugs fixed. [Simon Diesenreiter] +- Update Makefile. [Simon Diesenreiter] + + +0.1.1 (2024-11-27) +------------------ +- Bugfixes. [Simon Diesenreiter] +- ✅ Ready to clone and code. [simon] +- Init project. [Simon Diesenreiter] +- Initial commit. [Projects <>] + + diff --git a/Makefile b/Makefile index 30a2456..5fb9342 100644 --- a/Makefile +++ b/Makefile @@ -46,14 +46,7 @@ clean: issetup ## Clean unused files. .PHONY: release release: issetup ## Create a new tag for release. @echo "WARNING: This operation will create a version tag and push to gitea" - @read -p "Version? (provide the next x.y.z semver) : " TAG; echo "$$TAG" > DotnetTestLib/VERSION - @gitchangelog > HISTORY.md - @git add DotnetTestLib/VERSION HISTORY.md - @git commit -m "release: version $$(cat DotnetTestLib/VERSION) 🚀" - @echo "creating git tag : $$(cat DotnetTestLib/VERSION)" - @git tag $$(cat DotnetTestLib/VERSION) - @git push -u origin HEAD --tags - @echo "Gitea Actions will detect the new tag and release the new version." + . ./.gitea/conventional_commits/generate-version.sh .PHONY: docs docs: issetup ## Build the documentation.