-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathver-bump.sh
executable file
·67 lines (54 loc) · 1.59 KB
/
ver-bump.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# _ _ ___ ___ ___ _ _ __ __ ___
# | | || __>| . \ ___ | . >| | || \ \| . \
# | ' || _> | /|___|| . \| ' || || _/
# |__/ |___>|_\_\ |___/\___/|_|_|_||_|
#
# Description:
# - A handy utility that takes care of releasing Git software projects.
# Credits:
# - https://github.com/jv-k/ver-bump
#
# shellcheck disable=SC1090,SC2034,SC1017
true
MODULE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
source "$MODULE_DIR/lib/helpers.sh"
source "$MODULE_DIR/lib/icons.sh"
NOW="$(date +'%B %d, %Y')"
V_SUGGEST="0.1.0" # This is suggested in case VERSION file or user supplied version via -v is missing
VER_FILE="package.json"
GIT_MSG=""
REL_NOTE=""
REL_PREFIX="release-"
COMMIT_MSG_PREFIX="chore: " # Commit msg prefix for the file changes this script makes
PUSH_DEST="origin"
JSON_FILES=()
#### Initiate Script ###########################
main() {
# Process and prepare
process-arguments "$@"
check-commits-exist
process-version
check-branch-notexist
check-tag-exists
echo -e "\n${S_LIGHT}------"
# Update files
do-packagefile-bump
bump-json-files
do-versionfile
do-changelog
do-branch
do-commit
do-tag
do-push
echo -e "\n${S_LIGHT}------"
echo -ne "\n${I_OK} ${S_NOTICE}"
capitalise "$( get-commit-msg )"
echo -e "\n${I_END} ${GREEN}Done!\n"
}
# Execute script when it is executed as a script, and when it is brought into the environment with source (so it can be tested)
# shellcheck disable=SC2128
if [[ "$0" = "$BASH_SOURCE" ]]; then
source "$MODULE_DIR/lib/styles.sh" # only load when not sourced, for tests to work
main "$@"
fi