Skip to content

Commit 931f924

Browse files
committed
add helper script for releasing
1 parent 50dc813 commit 931f924

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

releasing/check-release-helper.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
declare PATCH=false
4+
declare MINOR=false
5+
declare MAJOR=false
6+
declare rc=0
7+
8+
git log $(git describe --tags --abbrev=0)..HEAD --oneline | tee /tmp/release-changelogs.txt
9+
10+
if [[ $(cat /tmp/release-changelogs.txt | grep fix) || $(cat /tmp/release-changelogs.txt | grep patch) ]]; then
11+
PATCH=true
12+
fi
13+
14+
if [[ $(cat /tmp/release-changelogs.txt | grep feat) ]]; then
15+
MINOR=true
16+
fi
17+
18+
for f in $(find api); do
19+
git diff --exit-code "${f}"
20+
if [ $? -eq 1 ]; then
21+
echo "Found changes on api dir at ${f}"
22+
rc=1
23+
exit 1
24+
fi
25+
done
26+
27+
if [ $rc -eq 1 ]; then
28+
MAJOR=true
29+
fi
30+
31+
echo -e "\n"
32+
echo -e "================================================================================="
33+
34+
if [[ $MAJOR == false && $MINOR == false ]]; then
35+
echo "Release type: patch"
36+
elif [[ $MAJOR == false && $MINOR == true ]]; then
37+
echo "Release type: minor"
38+
else
39+
echo "Release type: major"
40+
fi

0 commit comments

Comments
 (0)