chore: fix some bugs with conventional commits, ref NOISSUE
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after 31s
CI / linter (9.0.X, ubuntu-latest) (push) Failing after 1m28s
CI / tests_linux (9.0.X, ubuntu-latest) (push) Has been skipped

This commit is contained in:
2024-11-30 21:00:52 +01:00
parent 821d7ba0aa
commit e9f9da8cb0
4 changed files with 18 additions and 14 deletions

View File

@@ -7,8 +7,7 @@ echo "Running commit message checks..."
# Get the commit message # Get the commit message
commit="$(cat .git/COMMIT_EDITMSG)" commit="$(cat .git/COMMIT_EDITMSG)"
# Define the conventional commit regex # Define the conventional commit regex
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))))|(release: .*)$" 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))))|(release: .*)$'
# Check if the commit message matches the conventional commit format # Check if the commit message matches the conventional commit format
if ! echo "$commit" | grep -Pq "$regex" if ! echo "$commit" | grep -Pq "$regex"

View File

@@ -46,6 +46,7 @@ create_file() {
} }
get_commit_range() { get_commit_range() {
rm $TEMP_FILE_PATH/messages.txt
if [[ $LAST_TAG =~ $PATTERN ]]; then if [[ $LAST_TAG =~ $PATTERN ]]; then
create_file true create_file true
else else
@@ -62,16 +63,20 @@ start() {
increment_type="" increment_type=""
while read message; do while read message; do
if [[ $message =~ (([a-zA-Z]+)(\(.+\))?\!:)|(BREAKING CHANGE:) ]]; then echo $message
if echo $message | grep -Pq '(feat|style)(\([\w]+\))?!:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE)))'; then
increment_type="major" increment_type="major"
echo "a"
break break
elif [[ $message =~ (^(feat|style)(\(.+\))?:) ]]; then elif echo $message | grep -Pq '(feat|style)(\([\w]+\))?:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE)))'; then
if [ -z "$increment_type" ] || [ "$increment_type" == "patch" ]; then if [ -z "$increment_type" ] || [ "$increment_type" == "patch" ]; then
increment_type="minor" increment_type="minor"
fi echo "b"
elif [[ $message =~ ^((fix|build|perf|refactor|revert)(\(.+\))?:) ]]; then fi
elif echo $message | grep -Pq '(build|fix|perf|refactor|revert)(\(.+\))?:\s([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE)))'; then
if [ -z "$increment_type" ]; then if [ -z "$increment_type" ]; then
increment_type="patch" increment_type="patch"
echo "c"
fi fi
fi fi
done < $TEMP_FILE_PATH/messages.txt done < $TEMP_FILE_PATH/messages.txt
@@ -82,9 +87,10 @@ start() {
gitchangelog | grep -v "[rR]elease:" > HISTORY.md gitchangelog | grep -v "[rR]elease:" > HISTORY.md
git add DotnetTestLib/VERSION HISTORY.md git add DotnetTestLib/VERSION HISTORY.md
git commit -m "release: version $(cat DotnetTestLib/VERSION) 🚀" echo $new_version > DotnetTestLib/VERSION
echo "creating git tag : $(cat DotnetTestLib/VERSION)" git commit -m "release: version $new_version 🚀"
git tag $(cat DotnetTestLib/VERSION) echo "creating git tag : $new_version"
git tag $new_version
git push -u origin HEAD --tags git push -u origin HEAD --tags
echo "Gitea Actions will detect the new tag and release the new version." echo "Gitea Actions will detect the new tag and release the new version."
else else

View File

@@ -1 +1 @@
0.1.17 0.2.0

View File

@@ -45,14 +45,13 @@ clean: issetup ## Clean unused files.
.PHONY: release .PHONY: release
release: issetup ## Create a new tag for release. release: issetup ## Create a new tag for release.
@echo "WARNING: This operation will create a version tag and push to gitea" @./.gitea/conventional_commits/generate-version.sh
. ./.gitea/conventional_commits/generate-version.sh
.PHONY: docs .PHONY: docs
docs: issetup ## Build the documentation. docs: issetup ## Build the documentation.
@echo "building documentation ..." @echo "building documentation ..."
@$(ENV_PREFIX)mkdocs build @mkdocs build
URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL @URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL
# This project has been generated from rochacbruno/python-project-template # This project has been generated from rochacbruno/python-project-template
# __author__ = 'rochacbruno' # __author__ = 'rochacbruno'