File tree 1 file changed +75
-0
lines changed
1 file changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash -e
2
+
3
+ PLIST_FILE=" $PWD /mas-cli/mas-cli-Info.plist"
4
+
5
+ main () {
6
+ VERSION_NUMBER=$( update_version_number)
7
+
8
+ git add " $PLIST_FILE "
9
+ git commit -eF <( commit_message)
10
+
11
+ git tag -a " v${VERSION_NUMBER} "
12
+
13
+ echo " Finalise release with: git push --tags"
14
+ }
15
+
16
+ commit_message () {
17
+ cat << COMMIT_MESSAGE
18
+ Preparing release ${VERSION_NUMBER}
19
+ #
20
+ # To abort: Empty this file, Save and exit
21
+ COMMIT_MESSAGE
22
+ }
23
+
24
+ update_version_number () {
25
+ local version_number
26
+
27
+ # Get the current CFBundleShortVersionString
28
+ version_number=$( read_version_number)
29
+
30
+ # Ask for the new one
31
+ new_version_number=$( prompt " Enter version number [${version_number} ]: " )
32
+
33
+ if [[ -z $new_version_number ]]; then
34
+ echo " No version number specified"
35
+ return 1
36
+ fi
37
+
38
+ # Put it back
39
+ write_version_number " ${new_version_number} "
40
+ echo " ${new_version_number} "
41
+ }
42
+
43
+ prompt () {
44
+ local input
45
+ echo -n " ==> $1 " >&2
46
+ read -r input
47
+ echo " $input "
48
+ }
49
+
50
+ write_version_number () {
51
+ local value
52
+ value=$1 ; shift
53
+ write_plist " CFBundleShortVersionString" " ${value} "
54
+ }
55
+
56
+ read_version_number () {
57
+ read_plist " CFBundleShortVersionString"
58
+ }
59
+
60
+ read_plist () {
61
+ local key
62
+ key=$1 ; shift
63
+ /usr/libexec/PlistBuddy -c " Print :${key} " " ${PLIST_FILE} "
64
+ }
65
+
66
+ write_plist () {
67
+ local key
68
+ local value
69
+ key=$1 ; shift
70
+ value=$1 ; shift
71
+ echo " Setting ${key} to ${value} " >&2
72
+ /usr/libexec/PlistBuddy -c " Set :${key} ${value} " " ${PLIST_FILE} "
73
+ }
74
+
75
+ main
You can’t perform that action at this time.
0 commit comments