Skip to content

Commit

Permalink
ci: semantic versioning bash script (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gornak40 authored Feb 21, 2024
1 parent b348a27 commit 748bfea
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/semver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/bash
major=0
minor=0
patch=0

commits=$(git log --reverse --pretty=format:"%s")

while read -r commit_msg; do
if [[ $commit_msg == major* ]]; then
((major++))
minor=0
patch=0
elif [[ $commit_msg == feat* ]]; then
((minor++))
patch=0
else
((patch++))
fi
>&2 echo "[$major.$minor.$patch] $commit_msg"
done <<< $commits

echo "$major.$minor.$patch"

0 comments on commit 748bfea

Please sign in to comment.