-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathversion.sh
More file actions
executable file
·30 lines (25 loc) · 849 Bytes
/
version.sh
File metadata and controls
executable file
·30 lines (25 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
CURVER=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" AppGrid/AppGrid-Info.plist)
MAJOR=$(echo "$CURVER" | awk -F "." '{print $1}')
MINOR=$(echo "$CURVER" | awk -F "." '{print $2}')
PATCH=$(echo "$CURVER" | awk -F "." '{print $3}')
MSG=$(git log -1 --format=%s)
# Follow conventaional commits?
# https://www.conventionalcommits.org/en/v1.0.0/
case $MSG in
"fix"*)
PATCH=$(($PATCH + 1))
;;
"feat"*)
MINOR=$(($MINOR + 1))
PATCH="0"
;;
"BREAKING CHANGE"*)
MAJOR=$(($MAJOR + 1))
MINOR="0"
PATCH="0"
;;
esac
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $NEW_VERSION" AppGrid/AppGrid-Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $NEW_VERSION" AppGrid/AppGrid-Info.plist